public class FlatLists extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
FlatLists.AbstractFlatList<T>
Base class for flat lists.
|
private static class |
FlatLists.ComparableEmptyList<T>
Empty list that implements the
Comparable interface. |
static interface |
FlatLists.ComparableList<T>
List that is also comparable.
|
(package private) static class |
FlatLists.ComparableListImpl<T extends Comparable<T>>
Wrapper around a list that makes it implement the
Comparable
interface using lexical ordering. |
protected static class |
FlatLists.Flat1List<T>
List that stores its one elements in the one members of the class.
|
protected static class |
FlatLists.Flat2List<T>
List that stores its two elements in the two members of the class.
|
protected static class |
FlatLists.Flat3List<T>
List that stores its three elements in the three members of the class.
|
protected static class |
FlatLists.Flat4List<T>
List that stores its four elements in the four members of the class.
|
protected static class |
FlatLists.Flat5List<T>
List that stores its five elements in the five members of the class.
|
protected static class |
FlatLists.Flat6List<T>
List that stores its six elements in the six members of the class.
|
| Modifier and Type | Field and Description |
|---|---|
static FlatLists.ComparableEmptyList |
COMPARABLE_EMPTY_LIST |
| Modifier | Constructor and Description |
|---|---|
private |
FlatLists() |
| Modifier and Type | Method and 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> List<T> |
copyOf(T... t)
Creates a memory-, CPU- and cache-efficient immutable list,
always copying the contents.
|
static <T extends Comparable> |
copyOf(T... t)
Creates a memory-, CPU- and cache-efficient comparable immutable list,
always copying the contents.
|
private static <T extends Object & Comparable> |
flatList_(T[] t,
boolean copy)
Creates a memory-, CPU- and cache-efficient comparable immutable list,
optionally copying the list.
|
private static <T> List<T> |
flatListNotComparable(T[] t)
Creates a memory-, CPU- and cache-efficient immutable list,
always copying the list.
|
private static <T> FlatLists.ComparableList<T> |
of_(List<T> t) |
static <T> FlatLists.ComparableList<T> |
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 extends Comparable> |
of(T... t)
Creates a memory-, CPU- and cache-efficient immutable list.
|
static <T> List<T> |
of(T t0)
Creates a flat list with 1 element.
|
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.
|
static <T extends Comparable> |
ofComparable(List<T> t) |
public static final FlatLists.ComparableEmptyList COMPARABLE_EMPTY_LIST
public static <T> FlatLists.ComparableList<T> of()
public static <T> List<T> of(T t0)
public static <T> List<T> of(T t0, T t1)
public static <T> List<T> of(T t0, T t1, T t2)
public static <T> List<T> of(T t0, T t1, T t2, T t3)
public static <T> List<T> of(T t0, T t1, T t2, T t3, T t4)
public static <T> List<T> of(T t0, T t1, T t2, T t3, T t4, T t5)
public static <T extends Comparable> List<T> of(T... t)
T - Element typet - Array of members of list@Deprecated public static <T> List<T> copy(T... t)
T - Element typet - Array of members of listpublic static <T extends Comparable> List<T> copyOf(T... t)
The elements are comparable, and so is the returned list. Elements may be null.
T - Element typet - Array of members of listpublic static <T> List<T> copyOf(T... t)
The elements need not be comparable,
and the returned list may not implement Comparable.
Elements may be null.
T - Element typet - Array of members of listprivate static <T extends Object & Comparable> FlatLists.ComparableList<T> flatList_(T[] t, boolean copy)
copy - Whether to always copy the listt - Array of members of listprivate static <T> List<T> flatListNotComparable(T[] t)
t - Array of members of listpublic static <T> List<T> of(List<T> t)
T - Element typet - Array of members of listpublic static <T extends Comparable> FlatLists.ComparableList<T> ofComparable(List<T> t)
private static <T> FlatLists.ComparableList<T> of_(List<T> t)
public static <E> List<E> append(List<E> list, E e)
public static <E> com.google.common.collect.ImmutableList<E> append(com.google.common.collect.ImmutableList<E> list,
E e)
ImmutableList.public static <K,V> com.google.common.collect.ImmutableMap<K,V> append(Map<K,V> map, K k, V v)
ImmutableMap.Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.