public class CollectionHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static <V> java.util.Set<V> |
differenceMutable(java.util.Set<V> set1,
java.util.Set<V> set2)
Returns the difference of two sets (S1\S2).
|
static <V> java.util.Set<V> |
intersectionMutable(java.util.Set<V> set1,
java.util.Set<V> set2)
Returns the intersection of two sets.
|
public static <V> java.util.Set<V> intersectionMutable(java.util.Set<V> set1, java.util.Set<V> set2)
Set.retainAll(java.util.Collection)
but returns a new set
containing the elements of the intersection.set1
- the first set (can be null, interpreted as empty)set2
- the second set (can be null, interpreted as empty)public static <V> java.util.Set<V> differenceMutable(java.util.Set<V> set1, java.util.Set<V> set2)
Set.removeAll(java.util.Collection)
but returns a
new set containing the elements of the difference.set1
- the first set (can be null, interpreted as empty)set2
- the second set (can be null, interpreted as empty)