Class ComplementSet<T>

java.lang.Object
com.linkedin.venice.utils.ComplementSet<T>

public class ComplementSet<T> extends Object
A set that uses complement representation, which is useful when universal set cardinality is unknown. If "isComplement" is set to false, the ComplementSet is the same as a regular Set; if "isComplement" is set to true, the "elements" inside ComplementSet represents the elements that the Set doesn't have.
  • Constructor Details

    • ComplementSet

      protected ComplementSet(boolean isComplement, Set<T> elements)
  • Method Details

    • of

      public static <T> ComplementSet<T> of(T... elements)
    • wrap

      public static <T> ComplementSet<T> wrap(Set<T> elements)
      This API will reuse the input "elements" which cannot be unmodifiable.
    • newSet

      public static <T> ComplementSet<T> newSet(Collection<T> elements)
      This API will result in copying the data set, which is not performant or GC friendly if it's in critical path.
    • newSet

      public static <T> ComplementSet<T> newSet(ComplementSet<T> other)
    • emptySet

      public static <T> ComplementSet<T> emptySet()
    • universalSet

      public static <T> ComplementSet<T> universalSet()
      Returns a set that contains all possible elements and is represented as a complement of an empty set.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
    • clear

      public void clear()
    • contains

      public boolean contains(T element)
    • addAll

      public void addAll(ComplementSet<T> other)
    • removeAll

      public void removeAll(ComplementSet<T> other)