E - The type of the elements in the array.public final class DynamicArray<E>
extends java.util.AbstractCollection<E>
implements java.util.List<E>, java.util.RandomAccess, java.lang.Cloneable
| Constructor and Description |
|---|
DynamicArray()
This default constructor creates an instance of a dynamic array with the minimum
capacity (16 elements).
|
DynamicArray(java.util.Collection<? extends E> elements)
This constructor creates an instance of a dynamic array that contains the elements from
the specified collection.
|
DynamicArray(int minimumCapacity)
This constructor creates an instance of a dynamic array with at least the specified
minimum capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E element) |
void |
add(int index,
E element) |
boolean |
addAll(int index,
java.util.Collection<? extends E> collection) |
void |
clear() |
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object object) |
E |
get(int index) |
int |
hashCode() |
int |
indexOf(java.lang.Object element) |
java.util.ListIterator<E> |
iterator() |
int |
lastIndexOf(java.lang.Object element) |
java.util.ListIterator<E> |
listIterator() |
java.util.ListIterator<E> |
listIterator(int index) |
E |
remove(int index) |
DynamicArray<E> |
remove(int firstIndex,
int lastIndex)
This method removes the elements starting at the specified first index and
excluding the element referenced by the last index.
|
boolean |
remove(java.lang.Object object) |
E |
set(int index,
E element) |
int |
size() |
DynamicArray<E> |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitpublic DynamicArray()
public DynamicArray(int minimumCapacity)
minimumCapacity - The minimum initial size of the array.public DynamicArray(java.util.Collection<? extends E> elements)
elements - The elements that should be used to seed the array.public int size()
public int indexOf(java.lang.Object element)
indexOf in interface java.util.List<E>public int lastIndexOf(java.lang.Object element)
lastIndexOf in interface java.util.List<E>public boolean add(E element)
public boolean addAll(int index,
java.util.Collection<? extends E> collection)
addAll in interface java.util.List<E>public DynamicArray<E> remove(int firstIndex, int lastIndex)
firstIndex - The index of the first element to be removed.lastIndex - The index of the last element after the range to be removed.public boolean remove(java.lang.Object object)
public void clear()
public java.util.ListIterator<E> iterator()
public java.util.ListIterator<E> listIterator()
listIterator in interface java.util.List<E>public java.util.ListIterator<E> listIterator(int index)
listIterator in interface java.util.List<E>public DynamicArray<E> subList(int fromIndex, int toIndex)
subList in interface java.util.List<E>public java.lang.Object[] toArray()
public <T> T[] toArray(T[] array)
public boolean equals(java.lang.Object object)
public int hashCode()
public java.lang.Object clone()
clone in class java.lang.ObjectCopyright © 2015 Crater Dog Technologies(TM). All rights reserved.