OCLOperators difference
m ((username removed) (log details removed): Moving to Documentation namespace)
No edit summary
 
(6 intermediate revisions by 4 users 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.


Line 20: Line 21:
  Set{'a','b','c','d','e','f','g'}->difference(Set{'a','b','c','d','e','f'})
  Set{'a','b','c','d','e','f','g'}->difference(Set{'a','b','c','d','e','f'})
  = 'g'
  = 'g'
[[File:2019-11-25 13h27 03.png|none|thumb]]See: [[Examples_on_collection_operators]]
[[File:2019-11-25 13h27 03.png|none|thumb]]'''See''': [[Documentation:Examples on collection operators|Examples_on_collection_operators]]


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


See also: [[OCLOperators_symmetricDifference]]
'''See also''': [[Documentation:OCLOperators symmetricDifference|OCLOperators_symmetricDifference]]
 
'''VIDEO''': [https://youtu.be/Zs0wzJxOrlg?si=mb1BDym2P0wgazwZ OCL Operators: difference]
[[Category:OCL Collection Operators]]
[[Category:OCL Collection Operators]]
{{Edited|July|12|2025}}

Latest revision as of 05:55, 23 January 2025

This page was created by Alexandra on 2017-08-13. Last edited by Stephanie@mdriven.net on 2025-01-23.

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

VIDEO: OCL Operators: difference