Package com.linkedin.venice.utils
Class ComplementSet<T>
java.lang.Object
com.linkedin.venice.utils.ComplementSet<T>
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAll
(ComplementSet<T> other) void
clear()
boolean
static <T> ComplementSet<T>
emptySet()
boolean
isEmpty()
static <T> ComplementSet<T>
newSet
(ComplementSet<T> other) 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.static <T> ComplementSet<T>
of
(T... elements) void
removeAll
(ComplementSet<T> other) toString()
static <T> ComplementSet<T>
Returns a set that contains all possible elements and is represented as a complement of an empty set.static <T> ComplementSet<T>
This API will reuse the input "elements" which cannot be unmodifiable.
-
Constructor Details
-
ComplementSet
-
-
Method Details
-
of
-
wrap
This API will reuse the input "elements" which cannot be unmodifiable. -
newSet
This API will result in copying the data set, which is not performant or GC friendly if it's in critical path. -
newSet
-
emptySet
-
universalSet
Returns a set that contains all possible elements and is represented as a complement of an empty set. -
toString
-
isEmpty
public boolean isEmpty() -
clear
public void clear() -
contains
-
addAll
-
removeAll
-