T
- The type of the elements in the list.public class MixList<T>
extends java.util.ArrayList<T>
Constructor and Description |
---|
MixList(java.lang.Class<T> newType)
Constructor for MixList with the given element type.
|
MixList(java.lang.Class<T> newType,
int capacity)
Constructor for MixList with the given element type.
|
MixList(java.lang.Class<T> newType,
java.util.List items)
Constructor for MixList with the given element type and array.
|
MixList(java.lang.Class<T> newType,
T[] items)
Constructor for MixList with the given element type and array.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(T[] items)
Adds all elements in the given array to this.
|
T[] |
asArray()
Returns the elements in this as an array.
|
void |
copyToArray(T[] items)
Copies the elements from this to the given array.
|
static <T> T[] |
createArray(MixList<T> items)
Convenience method which lets a null list pass through or converts it to
an array otherwise.
|
static <T> T[] |
createArray(T... items)
Convenience method which creates an array out of the objects given.
|
static <T> MixList<T> |
createList(T... items)
Factory method for creating a list from several items or an array of
items without having to specify the class.
|
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
public MixList(java.lang.Class<T> newType)
newType
- The type of elements in the new list. Cannot be null.public MixList(java.lang.Class<T> newType, int capacity)
newType
- The type of elements in the new list. Cannot be null.capacity
- the initial capacity of this ArrayListpublic MixList(java.lang.Class<T> newType, java.util.List items)
newType
- The type of elements in the new list. Cannot be null.items
- The items to initially populate the list with. May be null or
empty.public final void addAll(T[] items)
items
- Adds all the elements in the array to this. Cannot be null,
but may be empty.public T[] asArray()
public final void copyToArray(T[] items)
items
- The array which will have its elements overwritten. Cannot be
null, and its length must be equal to a call from
List.size()
. The given array may only be empty if this
has no elements.public static <T> T[] createArray(MixList<T> items)
T
- The type of the input and output elements.items
- The items to form the array. If null or empty, the returned
array will be the same.public static <T> T[] createArray(T... items)
ECTrace.entry(long, String, String, Object[])
method calls.T
- The type of the input and output elements.items
- The items to be put in the array. If null or empty, the same
will be returned.public static <T> MixList<T> createList(T... items)
T
- The type of the elements in the list and array.items
- The items to put in the array. If null, null will be returned.