ELEMENTTYPE - The type of the elements in the list@NotThreadSafe public class SafeArrayList<ELEMENTTYPE> extends ArrayList<ELEMENTTYPE>
ArrayList that can handle read accesses on list
items that are not yet in the container. If get(int) is called with
an index that would normally throw an ArrayIndexOutOfBoundsException
this class will fill all indices between the current ArrayList.size() and the
desired index with values provided by an IFactory. If you don't pass
an IFactory in the constructor a default factory returning null
values is used.modCount| Constructor and Description |
|---|
SafeArrayList()
Constructor filling up the missing elements with
null values. |
SafeArrayList(IFactory<ELEMENTTYPE> aFactory)
Constructor with a custom factory to fill the missing elements.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
ELEMENTTYPE |
get(int nIndex) |
IFactory<ELEMENTTYPE> |
getFactory() |
int |
hashCode() |
ELEMENTTYPE |
set(int nIndex,
ELEMENTTYPE aElement) |
String |
toString() |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizecontainsAllfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAllparallelStream, streampublic SafeArrayList()
null values.public SafeArrayList(@Nonnull IFactory<ELEMENTTYPE> aFactory)
aFactory - The factory to use. May not be null.@Nonnull public IFactory<ELEMENTTYPE> getFactory()
public ELEMENTTYPE get(@Nonnegative int nIndex)
get in interface List<ELEMENTTYPE>get in class ArrayList<ELEMENTTYPE>public ELEMENTTYPE set(@Nonnegative int nIndex, @Nonnull ELEMENTTYPE aElement)
set in interface List<ELEMENTTYPE>set in class ArrayList<ELEMENTTYPE>public boolean equals(Object o)
equals in interface Collection<ELEMENTTYPE>equals in interface List<ELEMENTTYPE>equals in class AbstractList<ELEMENTTYPE>public int hashCode()
hashCode in interface Collection<ELEMENTTYPE>hashCode in interface List<ELEMENTTYPE>hashCode in class AbstractList<ELEMENTTYPE>public String toString()
toString in class AbstractCollection<ELEMENTTYPE>Copyright © 2014–2015 Philip Helger. All rights reserved.