OCLOperators union
(Updated Edited template to July 12, 2025.)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
=== union ( bag : Bag(T) ) : Bag(T) ===
=== union ( bag : Bag(T) ) : Bag(T) ===
Returns a Bag containing all elements of ''self'' and all elements of *bag*.
Returns a Bag containing all elements of ''self'' and all elements of *bag*.  
{| class="wikitable"
{| class="wikitable"
!Expression
!Expression
Line 6: Line 7:
|-
|-
|Bag{'a', 'b', 'a'}->union(Bag{'b', 'c'})
|Bag{'a', 'b', 'a'}->union(Bag{'b', 'c'})
|Bag{'b', 'a', 'b', 'a', 'c'}
|Bag{'a', 'b', 'a', 'c'}
|-
|Set{1,2,3}->union(Set{2,3,4})
|Set{1,2,3,4}
|}
|}
[[File:2019-11-25 13h28 15.png|none|thumb]]
[[File:2019-11-25 13h28 15.png|none|thumb]]
[[Category:OCLOperators]]
[[Category:OCL Collection Operators]]
Video: https://www.youtube.com/watch?v=-vBshXtEPts
 
{{Edited|July|12|2025}}

Latest revision as of 05:59, 20 January 2025

This page was created by Alexandra on 2017-08-14. Last edited by Edgar on 2025-01-20.

union ( bag : Bag(T) ) : Bag(T)

Returns a Bag containing all elements of self and all elements of *bag*.

Expression Result
Bag{'a', 'b', 'a'}->union(Bag{'b', 'c'}) Bag{'a', 'b', 'a', 'c'}
Set{1,2,3}->union(Set{2,3,4}) Set{1,2,3,4}
2019-11-25 13h28 15.png

Video: https://www.youtube.com/watch?v=-vBshXtEPts