protected static class Key2List.ReadOnlyKey2List<E,K1,K2> extends Key2List<E,K1,K2>
Key2List
.
It is used to implement both unmodifiable and immutable lists.
Note that the client cannot change the list, but the content may change if the underlying list is changed.Key2List.Builder<E,K1,K2>, Key2List.ReadOnlyKey2List<E,K1,K2>
IList.IListableFromArray<E>, IList.IListableFromCollection<E>, IList.IListableFromList<E>, IList.IListableFromMult<E>
Modifier | Constructor and Description |
---|---|
protected |
ReadOnlyKey2List(Key2List<E,K1,K2> that)
Private constructor used internally.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
doAdd(int index,
E elem)
Helper method for adding an element to the list.
|
protected void |
doClear() |
protected void |
doEnsureCapacity(int capacity)
Increases the capacity of this list instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
protected void |
doModify()
This method is called internally before elements are allocated or freed.
|
protected E |
doRemove(int index)
Helper method to remove an element.
|
protected void |
doRemoveAll(int index,
int len)
Remove specified range of elements from list.
|
protected E |
doReSet(int index,
E elem)
Sets an element at specified position.
|
protected E |
doSet(int index,
E elem)
Helper method for setting an element in the list.
|
protected void |
invalidateKey(int keyIndex,
java.lang.Object oldKey,
java.lang.Object newKey,
E elem)
Invalidate key value of element.
|
protected E |
putByKey(int keyIndex,
E elem,
boolean replace)
Put element by key into list.
|
protected IList<E> |
removeAllByKey(int keyIndex,
java.lang.Object key)
Removes element by key.
|
protected E |
removeByKey(int keyIndex,
java.lang.Object key)
Removes element by key.
|
asMap1, asMap2, clone, containsKey1, containsKey2, copy, count, crop, getAll, getAllByKey1, getAllByKey2, getAllKeys1, getAllKeys2, getBuilder, getByKey1, getByKey2, getCountByKey1, getCountByKey2, getDistinct, getDistinctKeys1, getDistinctKeys2, getKey1Mapper, getKey2Mapper, immutableList, indexOfKey1, indexOfKey2, invalidateKey1, invalidateKey2, isReadOnly, put, putByKey1, putByKey2, putIfAbsentByKey1, putIfAbsentByKey2, removeAll, removeAllByKey1, removeAllByKey2, removeByKey1, removeByKey2, unmodifiableList
add, add, asSet, binarySearch, capacity, clear, contains, containsKey, doAssign, doClone, doCreate, doGet, doGetAll, ensureCapacity, get, getAllByKey, getAllKeys, getByKey, getCountByKey, getDefaultElem, getDistinctKeys, getKeyMapper, indexOf, indexOfKey, indexOfKey, invalidate, isSorted, remove, set, size, sort, trimToSize, unwrap
addAll, addAll, addAll, addAll, addArray, addArray, addArray, addArray, addFirst, addIfAbsent, addLast, addMult, addMult, asDeque, asIListable, binarySearch, checkIndex, checkIndexAdd, checkLength, checkLengths, checkNonNull, checkRange, containsAll, containsAny, containsIf, copy, countIf, descendingIterator, doAddAll, doCreateArray, doIndexOf, doIndexOfIf, doInitAll, doLastIndexOf, doLastIndexOfIf, doPutAll, doReplace, doRotate, drag, element, equals, extract, extractIf, fill, filter, filterMap, flatMap, getAll, getFirst, getFirstOrNull, getIf, getLast, getLastOrNull, getSingle, getSingleOrNull, hashCode, indexOf, indexOfIf, indexOfIf, initAll, initAll, initArray, initMult, isEmpty, iterator, lastIndexOf, lastIndexOf, lastIndexOfIf, lastIndexOfIf, listIterator, listIterator, map, mapFilter, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, put, putAll, putAll, putArray, putMult, remove, remove, remove, removeAll, removeAll, removeFirst, removeFirstOccurrence, removeIf, removeLast, removeLastOccurrence, replace, replaceAll, replaceAll, replaceArray, replaceMult, resize, retain, retainAll, retainAll, retainIf, reverse, reverse, rotate, rotate, setAll, setAll, setArray, setArray, setMult, sort, swap, toArray, toArray, toArray, toArray, toArray, toArray, toString, transferCopy, transferMove, transferRemove, transferSwap, transform, transformedList
protected void doEnsureCapacity(int capacity)
IList
doEnsureCapacity
in class KeyListImpl<E>
capacity
- the desired minimum capacityprotected boolean doAdd(int index, E elem)
IList
doAdd
in class KeyListImpl<E>
index
- index where element should be added
(-1 means it is up to the implementation to choose the index)elem
- element to addprotected E doSet(int index, E elem)
IList
doSet
in class KeyListImpl<E>
index
- index where element will be placedelem
- element to setprotected E doReSet(int index, E elem)
IList
doReSet
in class KeyListImpl<E>
index
- index where element will be placedelem
- element to setprotected E doRemove(int index)
IList
doRemove
in class KeyListImpl<E>
index
- index of element to removeprotected void doRemoveAll(int index, int len)
IList
doRemoveAll
in class KeyListImpl<E>
index
- index of first element to removelen
- number of elements to removeprotected void doModify()
IList
protected E removeByKey(int keyIndex, java.lang.Object key)
KeyListImpl
removeByKey
in class KeyListImpl<E>
keyIndex
- key indexkey
- key of element to removeprotected IList<E> removeAllByKey(int keyIndex, java.lang.Object key)
KeyListImpl
removeAllByKey
in class KeyListImpl<E>
keyIndex
- key indexkey
- key of element to removeprotected E putByKey(int keyIndex, E elem, boolean replace)
KeyListImpl
putByKey
in class KeyListImpl<E>
keyIndex
- key indexelem
- element to putreplace
- true to replace an existing element with the same key, false to let the element unchangedprotected void invalidateKey(int keyIndex, java.lang.Object oldKey, java.lang.Object newKey, E elem)
KeyListImpl
invalidateKey
in class KeyListImpl<E>
keyIndex
- key indexoldKey
- old key valuenewKey
- new key valueelem
- element to invalidate (can be null if there are no duplicates with this key)