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:
  • Constructor Details

    • 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 Details

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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
    • onlyInSecond

      public Set<T> onlyInSecond()
      Returns the set of elements that are only in the second collection.
      Returns:
      Set of elements only in the second collection