Package de.xima.fc.utils
Class CollectionPartition<T>
- java.lang.Object
-
- de.xima.fc.utils.CollectionPartition<T>
-
- Type Parameters:
T- The type of elements in the collections
- All Implemented Interfaces:
Serializable
public final class CollectionPartition<T> extends Object implements Serializable
Represents a partition of two collections, where:- inBoth contains elements that are present in both collections
- onlyInFirst contains elements that are only in the first collection
- onlyInSecond contains elements that are only in the second collection
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)inthashCode()Set<T>inBoth()Returns the set of elements that are present in both collections.Set<T>onlyInFirst()Returns the set of elements that are only in the first collection.Set<T>onlyInSecond()Returns the set of elements that are only in the second collection.
-
-
-
Constructor Detail
-
CollectionPartition
public CollectionPartition(Set<T> onlyInFirst, Set<T> onlyInSecond, Set<T> inBoth)
Constructs a new collection partition with the specified sets.- Parameters:
onlyInFirst- Set of elements only in the first collection. null is treated as an empty set.onlyInSecond- Set of elements only in the second collection. null is treated as an empty set.inBoth- Set of elements present in both collections. null is treated as an empty set.
-
-
Method Detail
-
inBoth
public Set<T> inBoth()
Returns the set of elements that are present in both collections.- Returns:
- Set of elements in both collections
-
onlyInFirst
public Set<T> onlyInFirst()
Returns the set of elements that are only in the first collection.- Returns:
- Set of elements only in the first collection
-
-