Class FlatLists

java.lang.Object
org.apache.calcite.runtime.FlatLists

public class FlatLists extends Object
Space-efficient, comparable, immutable lists.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Base class for flat lists.
    static interface 
    List that is also comparable.
    protected static class 
    List that stores its one elements in the one members of the class.
    protected static class 
    List that stores its two elements in the two members of the class.
    protected static class 
    List that stores its three elements in the three members of the class.
    protected static class 
    List that stores its four elements in the four members of the class.
    protected static class 
    List that stores its five elements in the five members of the class.
    protected static class 
    List that stores its six elements in the six members of the class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.calcite.runtime.FlatLists.ComparableEmptyList
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <E> com.google.common.collect.ImmutableList<E>
    append(com.google.common.collect.ImmutableList<E> list, E e)
    Returns a list that consists of a given list plus an element, guaranteed to be an ImmutableList.
    static <E> List<E>
    append(List<E> list, E e)
    Returns a list that consists of a given list plus an element.
    static <K, V> com.google.common.collect.ImmutableMap<K,V>
    append(Map<K,V> map, K k, V v)
    Returns a map that consists of a given map plus an (key, value), guaranteed to be an ImmutableMap.
    static <T> List<T>
    copy(T... t)
    Deprecated.
    static <T extends Comparable>
    List<T>
    copyOf(T... t)
    Creates a memory-, CPU- and cache-efficient comparable immutable list, always copying the contents.
    of()
    Creates a flat list with 0 elements.
    static <T> List<T>
    of(List<T> t)
    Creates a memory-, CPU- and cache-efficient immutable list from an existing list.
    static <T> List<T>
    of(T t0)
    Creates a flat list with 1 element.
    static <T extends Comparable>
    List<T>
    of(T... t)
    Creates a memory-, CPU- and cache-efficient immutable list.
    static <T> List<T>
    of(T t0, T t1)
    Creates a flat list with 2 elements.
    static <T> List<T>
    of(T t0, T t1, T t2)
    Creates a flat list with 3 elements.
    static <T> List<T>
    of(T t0, T t1, T t2, T t3)
    Creates a flat list with 4 elements.
    static <T> List<T>
    of(T t0, T t1, T t2, T t3, T t4)
    Creates a flat list with 6 elements.
    static <T> List<T>
    of(T t0, T t1, T t2, T t3, T t4, T t5)
    Creates a flat list with 6 elements.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COMPARABLE_EMPTY_LIST

      public static final org.apache.calcite.runtime.FlatLists.ComparableEmptyList COMPARABLE_EMPTY_LIST
  • Method Details

    • of

      public static <T> FlatLists.ComparableList<T> of()
      Creates a flat list with 0 elements.
    • of

      public static <T> List<T> of(T t0)
      Creates a flat list with 1 element.
    • of

      public static <T> List<T> of(T t0, T t1)
      Creates a flat list with 2 elements.
    • of

      public static <T> List<T> of(T t0, T t1, T t2)
      Creates a flat list with 3 elements.
    • of

      public static <T> List<T> of(T t0, T t1, T t2, T t3)
      Creates a flat list with 4 elements.
    • of

      public static <T> List<T> of(T t0, T t1, T t2, T t3, T t4)
      Creates a flat list with 6 elements.
    • of

      public static <T> List<T> of(T t0, T t1, T t2, T t3, T t4, T t5)
      Creates a flat list with 6 elements.
    • of

      public static <T extends Comparable> List<T> of(T... t)
      Creates a memory-, CPU- and cache-efficient immutable list.
      Type Parameters:
      T - Element type
      Parameters:
      t - Array of members of list
      Returns:
      List containing the given members
    • copy

      @Deprecated public static <T> List<T> copy(T... t)
      Deprecated.
      Creates a memory-, CPU- and cache-efficient immutable list, always copying the contents.
      Type Parameters:
      T - Element type
      Parameters:
      t - Array of members of list
      Returns:
      List containing the given members
    • copyOf

      public static <T extends Comparable> List<T> copyOf(T... t)
      Creates a memory-, CPU- and cache-efficient comparable immutable list, always copying the contents.

      The elements are comparable, and so is the returned list. Elements may be null.

      Type Parameters:
      T - Element type
      Parameters:
      t - Array of members of list
      Returns:
      List containing the given members
    • copyOf

      public static <T> List<T> copyOf(T... t)
      Creates a memory-, CPU- and cache-efficient immutable list, always copying the contents.

      The elements need not be comparable, and the returned list may not implement Comparable. Elements may be null.

      Type Parameters:
      T - Element type
      Parameters:
      t - Array of members of list
      Returns:
      List containing the given members
    • of

      public static <T> List<T> of(List<T> t)
      Creates a memory-, CPU- and cache-efficient immutable list from an existing list. The list is always copied.
      Type Parameters:
      T - Element type
      Parameters:
      t - Array of members of list
      Returns:
      List containing the given members
    • ofComparable

      public static <T extends Comparable> FlatLists.ComparableList<T> ofComparable(List<T> t)
    • append

      public static <E> List<E> append(List<E> list, E e)
      Returns a list that consists of a given list plus an element.
    • append

      public static <E> com.google.common.collect.ImmutableList<E> append(com.google.common.collect.ImmutableList<E> list, E e)
      Returns a list that consists of a given list plus an element, guaranteed to be an ImmutableList.
    • append

      public static <K, V> com.google.common.collect.ImmutableMap<K,V> append(Map<K,V> map, K k, V v)
      Returns a map that consists of a given map plus an (key, value), guaranteed to be an ImmutableMap.