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:
Iterable<E>, Collection<E>, List<E>

public class ImmutableNullableList<E> extends AbstractList<E>
An immutable list that may contain null values.

If the list cannot contain null values, use ImmutableList.

  • Method Details

    • copyOf

      public static <E> List<E> copyOf(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> List<E> copyOf(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> 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> List<E> of(@Nullable E e1)
      Creates an immutable list of 1 element.
    • of

      public static <E> List<E> of(E e1, E e2)
      Creates an immutable list of 2 elements.
    • of

      public static <E> List<E> of(E e1, E e2, E e3)
      Creates an immutable list of 3 elements.
    • of

      public static <E> List<E> of(E e1, E e2, E e3, E e4)
      Creates an immutable list of 4 elements.
    • of

      public static <E> List<E> of(E e1, E e2, E e3, E e4, E e5)
      Creates an immutable list of 5 elements.
    • of

      public static <E> 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> 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> 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)
      Specified by:
      get in interface List<E>
      Specified by:
      get in class AbstractList<E>
    • size

      public int size()
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Specified by:
      size in class AbstractCollection<E>
    • builder

      public static <E> ImmutableNullableList.Builder<E> builder()
      Returns a new builder. The generated builder is equivalent to the builder created by the ImmutableNullableList.Builder constructor.