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
Modifier and TypeClassDescriptionstatic final class
A builder for creating immutable nullable set instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> ImmutableNullableSet.Builder<E>
builder()
Returns a new builder.boolean
static <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.boolean
boolean
removeAll
(Collection<?> c) int
size()
Methods inherited from class java.util.AbstractSet
equals, hashCode
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
add, addAll, clear, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Method Details
-
iterator
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classAbstractCollection<E>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceSet<E>
- Overrides:
removeAll
in 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.Builder
constructor.
-