aspose file tools*
The moose likes Beginning Java and the fly likes Opposite of a Union Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Opposite of a Union" Watch "Opposite of a Union" New topic
Author

Opposite of a Union

Noah Le
Greenhorn

Joined: Aug 12, 2003
Posts: 4
I can't remember the term. Can anyone tell me? It's when you take 2 sets of data and only keep data that's in both sets. also, does Java have a function that performs this action?
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
That's called an "intersection". The Java function, in the Set interface, is retainAll().
Union is addAll(). Set subtraction is removeAll().


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
 
Don't get me started about those stupid light bulbs.
 
subject: Opposite of a Union