ELEMENTTYPE - The type of the elements in the list@ThreadSafe public class SafeVector<ELEMENTTYPE> extends com.helger.commons.collection.impl.CommonsVector<ELEMENTTYPE>
CommonsVector 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 Vector.size() and the desired index with values
provided by an ISupplier. If you don't pass an ISupplier in
the constructor a default factory returning null values is used.capacityIncrement, elementCount, elementDatamodCount| Constructor and Description |
|---|
SafeVector()
Constructor filling up the missing elements with
null values. |
SafeVector(com.helger.commons.functional.ISupplier<? extends ELEMENTTYPE> aFactory)
Constructor with a custom factory to fill the missing elements.
|
| Modifier and Type | Method and Description |
|---|---|
ELEMENTTYPE |
computeIfAbsent(int nIndex,
Supplier<? extends ELEMENTTYPE> aFactory) |
boolean |
equals(Object o) |
ELEMENTTYPE |
get(int nIndex) |
com.helger.commons.functional.ISupplier<? extends ELEMENTTYPE> |
getFactory() |
int |
hashCode() |
ELEMENTTYPE |
set(int nIndex,
ELEMENTTYPE aElement) |
String |
toString() |
createFiltered, createFiltered, createFiltered, createFiltered, createInstance, getCloneadd, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, firstElement, forEach, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSizefinalize, getClass, notify, notifyAll, wait, wait, waitgetAll, getAllInstanceOf, getAllMapped, getAllMapped, getAsUnmodifiable, getAtIndex, getFirst, getFirst, getLast, getLast, getSortedInline, removeAndReturnElementAtIndex, removeAtIndex, removeFirst, removeLast, reverse, setFirst, setLast, swapItemsadd, add, addAll, addAll, clear, contains, containsAll, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArrayaddAll, addAll, addAll, addAll, addAll, addAll, addAll, addAll, addAllMapped, addAllMapped, addAllMapped, addAllMapped, addAllMapped, addAllMapped, addIf, addIfNotNull, addObject, getAtIndex, getAtIndex, getAtIndex, getAtIndexMapped, getAtIndexMapped, getAtIndexMapped, getAtIndexMapped, getCopyAsList, getCount, getSorted, iterator2, removeAll, removeObject, set, setAll, setAll, setAllMapped, setAllMappedparallelStream, removeIf, streamcontainsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstIndex, findFirstMapped, findFirstMapped, findLastIndex, forEach, forEachBreakable, forEachByIndex, getCountpublic SafeVector()
null values.public SafeVector(@Nonnull com.helger.commons.functional.ISupplier<? extends ELEMENTTYPE> aFactory)
aFactory - The factory to use. May not be null.@Nonnull public com.helger.commons.functional.ISupplier<? extends ELEMENTTYPE> getFactory()
public ELEMENTTYPE get(@Nonnegative int nIndex)
get in interface List<ELEMENTTYPE>get in class Vector<ELEMENTTYPE>@Nullable public ELEMENTTYPE computeIfAbsent(@Nonnegative int nIndex, @Nonnull Supplier<? extends ELEMENTTYPE> aFactory)
public ELEMENTTYPE set(@Nonnegative int nIndex, @Nonnull ELEMENTTYPE aElement)
set in interface List<ELEMENTTYPE>set in class Vector<ELEMENTTYPE>public boolean equals(Object o)
equals in interface Collection<ELEMENTTYPE>equals in interface List<ELEMENTTYPE>equals in class Vector<ELEMENTTYPE>public int hashCode()
hashCode in interface Collection<ELEMENTTYPE>hashCode in interface List<ELEMENTTYPE>hashCode in class Vector<ELEMENTTYPE>public String toString()
toString in class Vector<ELEMENTTYPE>Copyright © 2017–2020 Philip Helger. All rights reserved.