|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.inject.internal.util.Lists
public final class Lists
Static utility methods pertaining to List
instances. Also see this
class's counterparts Sets
and Maps
.
Method Summary | ||
---|---|---|
static
|
newArrayList()
Creates an empty ArrayList instance. |
|
static
|
newArrayList(E... elements)
Creates an ArrayList instance containing the given elements. |
|
static
|
newArrayList(E first,
E[] rest)
Returns an unmodifiable list containing the specified first element and the additional elements. |
|
static
|
newArrayList(Iterable<? extends E> elements)
Creates an ArrayList instance containing the given elements. |
|
static
|
newArrayList(Iterator<? extends E> elements)
Creates an ArrayList instance containing the given elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <E> ArrayList<E> newArrayList()
ArrayList
instance.
Note: if you need an immutable empty list, use Collections.emptyList()
instead.
ArrayList
public static <E> ArrayList<E> newArrayList(E... elements)
ArrayList
instance containing the given elements.
Note: if you need an immutable List, use ImmutableList
instead.
Note: due to a bug in javac 1.5.0_06, we cannot support the following:
List<Base> list = Lists.newArrayList(sub1, sub2);
where sub1
and sub2
are references to subtypes of Base
, not of Base
itself. To get around this, you must use:
List<Base> list = Lists.<Base>newArrayList(sub1, sub2);
elements
- the elements that the list should contain, in order
ArrayList
containing those elementspublic static <E> ArrayList<E> newArrayList(Iterable<? extends E> elements)
ArrayList
instance containing the given elements.
elements
- the elements that the list should contain, in order
ArrayList
containing those elementspublic static <E> ArrayList<E> newArrayList(Iterator<? extends E> elements)
ArrayList
instance containing the given elements.
elements
- the elements that the list should contain, in order
ArrayList
containing those elementspublic static <E> ArrayList<E> newArrayList(@Nullable E first, E[] rest)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |