Class CompositeList<T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
org.apache.calcite.util.CompositeList<T>
Type Parameters:
T - Element type
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>

public class CompositeList<T> extends AbstractList<T>
Read-only list that is the concatenation of sub-lists.

The list is read-only; attempts to call methods such as AbstractList.add(Object) or AbstractList.set(int, Object) will throw.

Changes to the backing lists, including changes in length, will be reflected in this list.

This class is not thread-safe. Changes to backing lists will cause unspecified behavior.

  • Method Details

    • of

      @SafeVarargs public static <T> CompositeList<T> of(List<? extends T>... lists)
      Creates a CompositeList.
      Type Parameters:
      T - Element type
      Parameters:
      lists - Constituent lists
      Returns:
      List consisting of all lists
    • ofCopy

      public static <T> CompositeList<T> ofCopy(Iterable<List<T>> lists)
      Creates a CompositeList.
      Type Parameters:
      T - Element type
      Parameters:
      lists - Constituent lists
      Returns:
      List consisting of all lists
    • of

      public static <T> List<T> of()
      Creates a CompositeList of zero lists.
      Type Parameters:
      T - Element type
      Returns:
      List consisting of all lists
    • of

      public static <T> List<T> of(List<T> list0)
      Creates a CompositeList of one list.
      Type Parameters:
      T - Element type
      Parameters:
      list0 - List
      Returns:
      List consisting of all lists
    • of

      public static <T> CompositeList<T> of(List<? extends T> list0, List<? extends T> list1)
      Creates a CompositeList of two lists.
      Type Parameters:
      T - Element type
      Parameters:
      list0 - First list
      list1 - Second list
      Returns:
      List consisting of all lists
    • of

      public static <T> CompositeList<T> of(List<? extends T> list0, List<? extends T> list1, List<? extends T> list2)
      Creates a CompositeList of three lists.
      Type Parameters:
      T - Element type
      Parameters:
      list0 - First list
      list1 - Second list
      list2 - Third list
      Returns:
      List consisting of all lists
    • get

      public T get(int index)
      Specified by:
      get in interface List<T>
      Specified by:
      get in class AbstractList<T>
    • size

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