• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Opposite of a Union

 
Noah Le
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1056
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's called an "intersection". The Java function, in the Set interface, is retainAll().
Union is addAll(). Set subtraction is removeAll().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic