Class Lists
- java.lang.Object
-
- org.glassfish.jersey.internal.guava.Lists
-
public final class Lists extends Object
Static utility methods pertaining toListinstances. Also see this class's counterpartsSets,MapsandQueues.See the Guava User Guide article on
Lists.- Since:
- 2.0 (imported from Google Collections Library)
- Author:
- Kevin Bourrillion, Mike Bostock, Louis Wasserman
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> ArrayList<E>newArrayList(Iterable<? extends E> elements)Creates a mutableArrayListinstance containing the given elements; a very thin shortcut for creating an empty list then callingIterables#addAll.static <E> ArrayList<E>newArrayList(Iterator<? extends E> elements)Creates a mutableArrayListinstance containing the given elements; a very thin shortcut for creating an empty list and then callingIterators.addAll(java.util.Collection<T>, java.util.Iterator<? extends T>).
-
-
-
Method Detail
-
newArrayList
public static <E> ArrayList<E> newArrayList(Iterable<? extends E> elements)
Creates a mutableArrayListinstance containing the given elements; a very thin shortcut for creating an empty list then callingIterables#addAll.Note: if mutability is not required and the elements are non-null, use
ImmutableList#copyOf(Iterable)instead. (Or, changeelementsto be aFluentIterableand callelements.toList().)Note for Java 7 and later: if
elementsis aCollection, you don't need this method. Use theArrayListconstructor directly, taking advantage of the new "diamond" syntax.
-
newArrayList
public static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements)
Creates a mutableArrayListinstance containing the given elements; a very thin shortcut for creating an empty list and then callingIterators.addAll(java.util.Collection<T>, java.util.Iterator<? extends T>).Note: if mutability is not required and the elements are non-null, use
ImmutableList#copyOf(Iterator)instead.
-
-