| Modifier and Type | Method and Description |
|---|---|
static <E> ArrayList |
newArrayList()
Returns a new mutable, empty
ArrayList instance.
|
static <E> ArrayList |
newArrayList(Iterable
Returns a new mutable
ArrayList instance containing the given elements.
|
static <E> ArrayList |
newArrayList(Iterator
Returns a new mutable
ArrayList instance containing the given elements.
|
static <E> ArrayList |
newArrayListWithCapacity(int initialArraySize)
Creates an
ArrayList instance backed by an array of the
exact size specified; equivalent to
ArrayList.
|
public static <E> ArrayList<E> newArrayList()
ArrayList instance.
public static <E> ArrayList<E> newArrayListWithCapacity(int initialArraySize)
ArrayList instance backed by an array of the
exact size specified; equivalent to
ArrayList.ArrayList(int) .
initialArraySize - the exact size of the initial backing array for the returned array list (
ArrayList documentation calls this value the "capacity")
ArrayList which is guaranteed not to resize itself unless its size reaches
initialArraySize + 1
IllegalArgumentException - if
initialArraySize is negative
public 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 elements