Package org.apache.calcite.util
Class ImmutableNullableList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- org.apache.calcite.util.ImmutableNullableList<E>
-
- Type Parameters:
E
- Element type
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
public class ImmutableNullableList<E> extends java.util.AbstractList<E>
An immutable list that may contain null values.If the list cannot contain null values, use
ImmutableList
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableNullableList.Builder<E>
A builder for creating immutable nullable list instances.
-
Field Summary
Fields Modifier and Type Field Description private E[]
elements
private static java.util.List
SINGLETON_NULL
-
Constructor Summary
Constructors Modifier Constructor Description private
ImmutableNullableList(E[] elements)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <E> ImmutableNullableList.Builder<E>
builder()
Returns a new builder.static <E> java.util.List<E>
copyOf(E[] elements)
Returns an immutable list containing the given elements, in order.static <E> java.util.List<E>
copyOf(java.lang.Iterable<? extends E> elements)
Returns an immutable list containing the given elements, in order.static <E> java.util.List<E>
copyOf(java.util.Collection<? extends E> elements)
Returns an immutable list containing the given elements, in order.E
get(int index)
static <E> java.util.List<E>
of(E e1)
Creates an immutable list of 1 element.static <E> java.util.List<E>
of(E e1, E e2)
Creates an immutable list of 2 elements.static <E> java.util.List<E>
of(E e1, E e2, E e3)
Creates an immutable list of 3 elements.static <E> java.util.List<E>
of(E e1, E e2, E e3, E e4)
Creates an immutable list of 4 elements.static <E> java.util.List<E>
of(E e1, E e2, E e3, E e4, E e5)
Creates an immutable list of 5 elements.static <E> java.util.List<E>
of(E e1, E e2, E e3, E e4, E e5, E e6)
Creates an immutable list of 6 elements.static <E> java.util.List<E>
of(E e1, E e2, E e3, E e4, E e5, E e6, E e7)
Creates an immutable list of 7 elements.static <E> java.util.List<E>
of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E... others)
Creates an immutable list of 8 or more elements.int
size()
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
SINGLETON_NULL
private static final java.util.List SINGLETON_NULL
-
elements
private final E[] elements
-
-
Constructor Detail
-
ImmutableNullableList
private ImmutableNullableList(E[] elements)
-
-
Method Detail
-
copyOf
public static <E> java.util.List<E> copyOf(java.util.Collection<? extends E> elements)
Returns an immutable list containing the given elements, in order.Behavior as
ImmutableList.copyOf(java.util.Collection)
except that this list allows nulls.
-
copyOf
public static <E> java.util.List<E> copyOf(java.lang.Iterable<? extends E> elements)
Returns an immutable list containing the given elements, in order.Behavior as
ImmutableList.copyOf(Iterable)
except that this list allows nulls.
-
copyOf
public static <E> java.util.List<E> copyOf(E[] elements)
Returns an immutable list containing the given elements, in order.Behavior as
ImmutableList.copyOf(Object[])
except that this list allows nulls.
-
of
public static <E> java.util.List<E> of(E e1)
Creates an immutable list of 1 element.
-
of
public static <E> java.util.List<E> of(E e1, E e2)
Creates an immutable list of 2 elements.
-
of
public static <E> java.util.List<E> of(E e1, E e2, E e3)
Creates an immutable list of 3 elements.
-
of
public static <E> java.util.List<E> of(E e1, E e2, E e3, E e4)
Creates an immutable list of 4 elements.
-
of
public static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5)
Creates an immutable list of 5 elements.
-
of
public static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6)
Creates an immutable list of 6 elements.
-
of
public static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7)
Creates an immutable list of 7 elements.
-
of
public static <E> java.util.List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E... others)
Creates an immutable list of 8 or more elements.
-
get
public E get(int index)
-
size
public int size()
-
builder
public static <E> ImmutableNullableList.Builder<E> builder()
Returns a new builder. The generated builder is equivalent to the builder created by theImmutableNullableList.Builder
constructor.
-
-