Package org.apache.calcite.util
Class ImmutableNullableSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.apache.calcite.util.ImmutableNullableSet<E>
- Type Parameters:
E- Element type
- All Implemented Interfaces:
Iterable<E>,Collection<E>,Set<E>
An immutable set that may contain null values.
If the set cannot contain null values, use ImmutableSet.
We do not yet support sorted sets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for creating immutable nullable set instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> ImmutableNullableSet.Builder<E>builder()Returns a new builder.booleanstatic <E> Set<E>copyOf(E[] elements) Returns an immutable set containing the given elements.static <E> Set<E>Returns an immutable set containing the given elements.iterator()static <E> Set<E>of(E e1) Creates an immutable set of 1 element.static <E> Set<E>of(E e1, E e2) Creates an immutable set of 2 elements.static <E> Set<E>of(E e1, E e2, E e3) Creates an immutable set of 3 elements.static <E> Set<E>of(E e1, E e2, E e3, E e4) Creates an immutable set of 4 elements.static <E> Set<E>of(E e1, E e2, E e3, E e4, E e5, E... others) Creates an immutable set of 5 or more elements.booleanbooleanremoveAll(Collection<?> c) intsize()Methods inherited from class java.util.AbstractSet
equals, hashCodeMethods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
add, addAll, clear, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Method Details
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
remove
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
copyOf
Returns an immutable set containing the given elements.Behavior is as
ImmutableSet.copyOf(Iterable)except that this set allows nulls. -
copyOf
Returns an immutable set containing the given elements.Behavior as
ImmutableSet.copyOf(Object[])except that this set allows nulls. -
of
Creates an immutable set of 1 element. -
of
Creates an immutable set of 2 elements. -
of
Creates an immutable set of 3 elements. -
of
Creates an immutable set of 4 elements. -
of
Creates an immutable set of 5 or more elements. -
builder
Returns a new builder. The generated builder is equivalent to the builder created by theImmutableNullableSet.Builderconstructor.
-