OCLOperators Bag
No edit summary
(Updated Edited template to July 12, 2025.)
Line 14: Line 14:
See also: [[OCLOperators Set|Set]]
See also: [[OCLOperators Set|Set]]
[[Category:OCLOperators]]
[[Category:OCLOperators]]
{{Edited|July|12|2024}}
{{Edited|July|12|2025}}

Revision as of 05:54, 20 January 2025

This page was created by Lars.olofsson@mdriven.net on 2021-02-11. Last edited by Stephanie@mdriven.net on 2025-02-07.

You can use Bag with { } to create a set you may use to loop over.

A Bag can contain duplicates, so it's just a collection of something.

With Integers:

Bag{14,22,12,53,2,11,66}->collect(i| DoSomthingWithAnInt(i)) 

With Strings:

Bag{'String', 'EmailAddress'}->collect(s| DoSomthingWithAString(s)) 

If you want to create a sequence of numbers (in order), you can use the Sequence operator.

Other names for set: collection of strings, array of numbers, static array, initialize array, list of numbers

See also: Set