Package org.elasticsearch.common.collect
Class List
java.lang.Object
org.elasticsearch.common.collect.List
public class List
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description List() -
Method Summary
Modifier and Type Method Description static <T> java.util.List<T>copyOf(java.util.Collection<? extends T> coll)Returns an unmodifiableListcontaining the elements of the givenCollectionin iteration order.static <T> java.util.List<T>of()Returns an unmodifiable list containing zero elements.static <T> java.util.List<T>of(T e1)Returns an unmodifiable list containing one element.static <T> java.util.List<T>of(T... entries)Returns an unmodifiable list containing an arbitrary number of elements.static <T> java.util.List<T>of(T e1, T e2)Returns an unmodifiable list containing two elements.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
List
public List()
-
-
Method Details
-
of
public static <T> java.util.List<T> of()Returns an unmodifiable list containing zero elements.- Type Parameters:
T- theList's element type- Returns:
- an empty
List
-
of
public static <T> java.util.List<T> of(T e1)Returns an unmodifiable list containing one element.- Type Parameters:
T- theList's element type- Parameters:
e1- the single element- Returns:
- a
Listcontaining the specified element
-
of
public static <T> java.util.List<T> of(T e1, T e2)Returns an unmodifiable list containing two elements.- Type Parameters:
T- theList's element type- Parameters:
e1- the first elemente2- the second element- Returns:
- a
Listcontaining the specified element
-
of
@SafeVarargs public static <T> java.util.List<T> of(T... entries)Returns an unmodifiable list containing an arbitrary number of elements.- Type Parameters:
T- theList's element type- Parameters:
entries- the elements to be contained in the list- Returns:
- an unmodifiable list containing the specified elements.
-
copyOf
public static <T> java.util.List<T> copyOf(java.util.Collection<? extends T> coll)Returns an unmodifiableListcontaining the elements of the givenCollectionin iteration order.- Type Parameters:
T- theList's element type- Parameters:
coll- aCollectionfrom which elements are drawn, must be non-null- Returns:
- a
Listcontaining the elements of the givenCollection
-