OCLOperators difference
(Automatically adding template at the end of the page.)
(Replacing message template with parser tag)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<message>Write the content here to display this box</message>
The difference between 2 collections: collection2 subtracted from collection1.
The difference between 2 collections: collection2 subtracted from collection1.



Latest revision as of 07:50, 17 June 2024

The difference between 2 collections: collection2 subtracted from collection1.

Example: for A,B,C,D and B,C,D,E,F the difference is A.

Set{'a','b','c','d'}->difference(Set{'b','c','d','e'})
= 'a'

Set{'a','b','c','d','e'}->difference(Set{'b','c','d','e'})
= 'a'

Set{'a','b','c','d','e','f'}->difference(Set{'b','c','d','e'})
='a','f'
Set{'a','b','c','d','e','f'}->difference(Set{'a','b','c','d','e','f'})
= empty
Set{'a','b','c','d','e','f'}->difference(Set{'a','b','c','d','e','f','g'})
= empty
Set{'a','b','c','d','e','f','g'}->difference(Set{'a','b','c','d','e','f'})
= 'g'
2019-11-25 13h27 03.png

See: Examples_on_collection_operators

In Linq, this can be achieved with "Except".

See also: OCLOperators_symmetricDifference

This page was edited 95 days ago on 06/17/2024. What links here