public class ReifiedArrayList<T> extends java.lang.Object implements ReifiedList<T>
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SIZE |
Constructor and Description |
---|
ReifiedArrayList()
Default constructor
|
ReifiedArrayList(java.lang.Class<?> genericTypeParameter)
Constructor for initializing with the generic type parameter
|
ReifiedArrayList(int initialSize)
Constructor initializes with an initial collection size.
|
ReifiedArrayList(int initialSize,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with an initial collection size and a generic type parameter.
|
ReifiedArrayList(java.lang.Iterable<? extends T> iterable)
Constructor initializes with an initial collection and this class's generic type parameter
|
ReifiedArrayList(java.lang.Iterable<? extends T> iterable,
java.lang.Class<?> genericTypeParameter)
Constructor initializes with an initial collection and this class's generic type parameter
|
ReifiedArrayList(ReifiedIterable<T> iterable)
Constructor initializes from another reified collection
|
ReifiedArrayList(T[] array)
Initializes with an array.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element)
Inserts the specified element at the specified position in this list.
|
boolean |
add(T t)
Adds an element to the collection.
|
boolean |
addAll(java.util.Collection<? extends T> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified
collection's Iterator.
|
boolean |
addAll(int index,
java.util.Collection<? extends T> collection)
Inserts the specified elements at the specified position in this list.
|
boolean |
addAll(T[] array)
Appends all of the elements in the specified array to the end of this list, in the order that they are ordered.
|
void |
clear()
Empties the list and re-creates the internal buffer with a default size.
|
boolean |
contains(java.lang.Object o)
Scans the collection linearly and returns true if the specified element is found.
|
boolean |
containsAll(java.util.Collection<?> collection)
Returns true if all elements in the provided collection are contained in this collection.
|
T |
get(int index)
Returns the element at the specified index.
|
java.lang.Class<?> |
getGenericTypeParameter()
Returns the formal type parameter as a class
|
int |
indexOf(java.lang.Object o)
Scans the collection linearly from start to end and returns the index of the element specified.
|
boolean |
isEmpty()
Returns true if the list is empty.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over the backing array.
|
int |
lastIndexOf(java.lang.Object o)
Scans the collection linearly from end to start returns the index of the element specified.
|
java.util.ListIterator<T> |
listIterator()
Returns a list iterator over the backing array.
|
java.util.ListIterator<T> |
listIterator(int index)
Returns a list iterator over the backing array, starting at the specified index.
|
T |
remove(int index)
Removes the element at the specified position.
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence of an element.
|
boolean |
removeAll(java.util.Collection<?> collection)
Removes all items in the provided collection from this list.
|
boolean |
retainAll(java.util.Collection<?> collection)
Removes from this list all items not contained in the given collection.
|
T |
set(int index,
T element)
Replaces the element at the specified position in this list with the specified element.
|
int |
size() |
ReifiedList<T> |
subList(int fromIndex,
int toIndex)
Creates a sub-list from this list.
|
T[] |
toArray()
Returns all elements in an array copy.
|
<T> T[] |
toArray(T[] a)
Returns all elements in an array.
|
ReifiedList<T> |
toList()
Returns a copy of this list.
|
public static final int DEFAULT_SIZE
public ReifiedArrayList()
SuperTypeTokenException
- When called without using anonymous class semantics.public ReifiedArrayList(java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When the generic type parameter is null.public ReifiedArrayList(int initialSize)
SuperTypeTokenException
- When called without using anonymous class semantics.java.lang.IllegalArgumentException
- When the size is non positive.public ReifiedArrayList(int initialSize, java.lang.Class<?> genericTypeParameter)
java.lang.IllegalArgumentException
- When the buffer size is non positive.java.lang.NullPointerException
- When the generic type parameter is null.public ReifiedArrayList(ReifiedIterable<T> iterable)
java.lang.NullPointerException
- When the argument is nullpublic ReifiedArrayList(java.lang.Iterable<? extends T> iterable)
java.lang.NullPointerException
- When the argument is nullSuperTypeTokenException
- When called without using anonymous class semantics.public ReifiedArrayList(java.lang.Iterable<? extends T> iterable, java.lang.Class<?> genericTypeParameter)
java.lang.NullPointerException
- When an argument is nullpublic ReifiedArrayList(T[] array)
java.lang.NullPointerException
- When the argument is nullpublic boolean add(T t)
public void add(int index, T element)
add
in interface java.util.List<T>
java.lang.IndexOutOfBoundsException
- If the index is out of rangepublic boolean addAll(java.util.Collection<? extends T> c)
public boolean addAll(T[] array)
addAll
in interface ReifiedList<T>
java.lang.NullPointerException
- If the array is null.public boolean addAll(int index, java.util.Collection<? extends T> collection)
addAll
in interface java.util.List<T>
java.lang.IndexOutOfBoundsException
- If the index is out of rangejava.lang.NullPointerException
- The collection provided is null.public void clear()
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> collection)
public T get(int index)
get
in interface java.util.List<T>
java.lang.IndexOutOfBoundsException
- When the index is out of rangepublic java.lang.Class<?> getGenericTypeParameter()
getGenericTypeParameter
in interface ReifiedIterable<T>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<T>
public boolean isEmpty()
public java.util.Iterator<T> iterator()
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<T>
public java.util.ListIterator<T> listIterator()
listIterator
in interface java.util.List<T>
public java.util.ListIterator<T> listIterator(int index)
listIterator
in interface java.util.List<T>
java.lang.IndexOutOfBoundsException
- When the index is out of rangepublic boolean remove(java.lang.Object o)
public T remove(int index)
remove
in interface java.util.List<T>
java.lang.IndexOutOfBoundsException
- When the index is out of range.public boolean removeAll(java.util.Collection<?> collection)
public boolean retainAll(java.util.Collection<?> collection)
public T set(int index, T element)
set
in interface java.util.List<T>
java.lang.IndexOutOfBoundsException
- When the index is out of rangepublic int size()
public ReifiedList<T> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<T>
subList
in interface ReifiedList<T>
public ReifiedList<T> toList()
public T[] toArray()
toArray
in interface java.util.Collection<T>
toArray
in interface java.util.List<T>
toArray
in interface ReifiedList<T>
public <T> T[] toArray(T[] a)