Package org.leplus.ristretto.util
Class ArrayListVector<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<E>
-
- org.leplus.ristretto.util.VectorAdapter<E>
-
- org.leplus.ristretto.util.ArrayListVector<E>
-
- Type Parameters:
E- type of the elements in the collection.
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,List<E>,RandomAccess
public class ArrayListVector<E> extends VectorAdapter<E>
AnArrayList-backed implementation ofVectorAdapter.Using this class introduces a small memory overhead compared to using an
ArrayListdirectly. Typically that overhead is the size of an emptyVector, e.g. 48 bytes on Oracle Java HotSpot 1.8.0 for Windows (64-Bit).- Since:
- 1.0.0
- Author:
- Thomas Leplus
- See Also:
VectorAdapter, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ArrayListVector()Constructs an empty list with an initial capacity of ten.ArrayListVector(int initialCapacity)Constructs an empty list with the specified initial capacity.ArrayListVector(Collection<? extends E> c)Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayListVector<E>clone()voidensureCapacity(int minCapacity)booleanequals(Object obj)inthashCode()StringtoString()voidtrimToSize()-
Methods inherited from class org.leplus.ristretto.util.VectorAdapter
add, add, addAll, addAll, addElement, capacity, clear, contains, containsAll, copyInto, elementAt, elements, firstElement, forEach, get, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
-
-
-
Constructor Detail
-
ArrayListVector
public ArrayListVector()
Constructs an empty list with an initial capacity of ten.
-
ArrayListVector
public ArrayListVector(Collection<? extends E> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.- Parameters:
c- the collection whose elements are to be placed into this list.- Throws:
NullPointerException- if the specified collection is null.
-
ArrayListVector
public ArrayListVector(int initialCapacity)
Constructs an empty list with the specified initial capacity.- Parameters:
initialCapacity- the initial capacity of the list.- Throws:
IllegalArgumentException- if the specified initial capacity is negative.
-
-
Method Detail
-
clone
public ArrayListVector<E> clone()
- Overrides:
clonein classVectorAdapter<E>- See Also:
VectorAdapter.clone()
-
ensureCapacity
public void ensureCapacity(int minCapacity)
- Specified by:
ensureCapacityin classVectorAdapter<E>- See Also:
VectorAdapter.ensureCapacity(int)
-
trimToSize
public void trimToSize()
- Specified by:
trimToSizein classVectorAdapter<E>- See Also:
VectorAdapter.trimToSize()
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceList<E>- Overrides:
hashCodein classVectorAdapter<E>- See Also:
VectorAdapter.hashCode()
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceList<E>- Overrides:
equalsin classVectorAdapter<E>- See Also:
VectorAdapter.equals(Object)
-
toString
public String toString()
- Overrides:
toStringin classVectorAdapter<E>- See Also:
VectorAdapter.hashCode()
-
-