OCLOperators intersection
No edit summary
No edit summary
Line 1: Line 1:
The intersection of two collections
=== intersection ( bag : Bag(T) ) : Bag(T) ===
 
Returns a Bag containing all elements of ''self'' that are also contained by *bag*.
Example for A,B,C,D and C,D,E intersection is C,D
{| class="wikitable"
!Expression
!Result
|-
|Bag{'a', 'b', 'a'}->intersection(Bag{'a', 'b'})
|Bag{'a', 'b'}
|-
|Bag{'a', 'b', 'a', 'b'}->intersection(Bag{'a', 'b', 'b'})
|Bag{'b', 'a', 'b'}
|}
[[Category:OCLOperators]]
[[Category:OCLOperators]]

Revision as of 14:41, 18 November 2019

intersection ( bag : Bag(T) ) : Bag(T)

Returns a Bag containing all elements of self that are also contained by *bag*.

Expression Result
Bag{'a', 'b', 'a'}->intersection(Bag{'a', 'b'}) Bag{'a', 'b'}
Bag{'a', 'b', 'a', 'b'}->intersection(Bag{'a', 'b', 'b'}) Bag{'b', 'a', 'b'}
This page was edited 76 days ago on 02/10/2024. What links here