E - type of elements stored in the listK1 - type of first keyK2 - type of second keypublic class Key2List<E,K1,K2> extends KeyListImpl<E>
| Modifier and Type | Class and Description |
|---|---|
static class |
Key2List.Builder<E,K1,K2>
Builder to construct Key2List instances.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<K1,E> |
asMap1()
Returns a map view to the key map.
|
java.util.Map<K2,E> |
asMap2()
Returns a map view to the key map.
|
boolean |
containsKey1(K1 key)
Checks whether an element with specified key exists.
|
boolean |
containsKey2(K2 key)
Checks whether an element with specified key exists.
|
Key2List<E,K1,K2> |
copy()
Returns a shallow copy of this list instance.
|
Key2List<E,K1,K2> |
crop()
Returns a copy this list but without elements.
|
IList<E> |
getAll(E elem)
Returns all elements in the list equal to the specified element.
|
GapList<E> |
getAllByKey1(K1 key)
Returns all elements with specified key.
|
GapList<E> |
getAllByKey2(K2 key)
Returns all elements with specified key.
|
GapList<K1> |
getAllKeys1()
Returns list containing all keys in element order.
|
GapList<K2> |
getAllKeys2()
Returns list containing all keys in element order.
|
E |
getByKey1(K1 key)
Returns element with specified key.
|
E |
getByKey2(K2 key)
Returns element with specified key.
|
int |
getCount(E elem)
Counts how many times the specified element is contained in the list.
|
int |
getCountByKey1(K1 key)
Returns the number of elements with specified key.
|
int |
getCountByKey2(K2 key)
Returns the number of elements with specified key.
|
java.util.Set<E> |
getDistinct()
Returns distinct elements in the list.
|
java.util.Set<K1> |
getDistinctKeys1()
Returns all distinct keys in the same order as in the key map.
|
java.util.Set<K2> |
getDistinctKeys2()
Returns all distinct keys in the same order as in the key map.
|
IFunction<E,K1> |
getKey1Mapper()
Returns mapper for key map.
|
IFunction<E,K2> |
getKey2Mapper()
Returns mapper for key map.
|
int |
indexOfKey1(K1 key)
Returns index of first element in list with specified key.
|
int |
indexOfKey2(K2 key)
Returns index of first element in list with specified key.
|
void |
invalidateKey1(K1 oldKey,
K1 newKey,
E elem)
Invalidate key value of element.
|
void |
invalidateKey2(K2 oldKey,
K2 newKey,
E elem)
Invalidate key value of element.
|
E |
put(E elem)
Adds or replaces element.
|
E |
putByKey1(E elem)
Adds or replaces element by key.
|
E |
putByKey2(E elem)
Adds or replaces element by key.
|
IList<E> |
removeAll(E elem)
Removes all equal elements.
|
GapList<E> |
removeAllByKey1(K1 key)
Removes all elements with specified key.
|
GapList<E> |
removeAllByKey2(K2 key)
Removes all elements with specified key.
|
E |
removeByKey1(K1 key)
Removes element with specified key.
|
E |
removeByKey2(K2 key)
Removes element with specified key.
|
Key2List<E,K1,K2> |
unmodifiableList()
Returns an unmodifiable view of this list.
|
add, add, addIf, asSet, binarySearch, capacity, clear, clone, contains, containsKey, ensureCapacity, get, getAllByKey, getByKey, getCountByKey, getDistinctKeys, getKeyMapper, indexOf, indexOfKey, indexOfKey, isSorted, set, size, sort, trimToSizeaddAll, addAll, addAll, addAll, addArray, addArray, addFirst, addIfAbsent, addLast, addMult, addMult, binarySearch, containsAll, containsAny, copy, descendingIterator, drag, element, equals, extract, extractWhere, fill, filter, getAll, getArray, getFirst, getLast, getWhere, hashCode, indexOf, initAll, initAll, initArray, initMult, isEmpty, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, mappedList, move, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, put, putAll, putAll, putArray, putMult, remove, remove, remove, remove, removeAll, removeAll, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, removeWhere, replaceAll, replaceAll, replaceArray, replaceMult, resize, retainAll, retainAll, retainWhere, reverse, reverse, rotate, rotate, setAll, setAll, setArray, setMult, sort, swap, toArray, toArray, toArray, toString, transferCopy, transferMove, transferRemove, transferSwappublic Key2List<E,K1,K2> copy()
IListcopy in class KeyListImpl<E>IList.clone()public Key2List<E,K1,K2> crop()
KeyListImplcrop in class KeyListImpl<E>public IList<E> getAll(E elem)
IListgetAll in class KeyListImpl<E>elem - element to look forpublic int getCount(E elem)
IListgetCount in class KeyListImpl<E>elem - element to countpublic IList<E> removeAll(E elem)
IListremoveAll in class KeyListImpl<E>elem - elementpublic java.util.Set<E> getDistinct()
IListgetDistinct in class KeyListImpl<E>public E put(E elem)
KeyListImpl
if (contains(elem)) {
remove(elem);
}
add(elem);
However the method is atomic in the sense that all or none operations are executed.
So if there is already such an element, but adding the new one fails due to a constraint violation,
the old element remains in the list.elem - elementpublic IFunction<E,K1> getKey1Mapper()
public java.util.Map<K1,E> asMap1()
java.lang.IllegalArgumentException - if the key map cannot be viewed as Mappublic int indexOfKey1(K1 key)
key - keypublic boolean containsKey1(K1 key)
key - keypublic E getByKey1(K1 key)
key - keypublic GapList<E> getAllByKey1(K1 key)
key - keypublic int getCountByKey1(K1 key)
key - keypublic E removeByKey1(K1 key)
key - keypublic GapList<E> removeAllByKey1(K1 key)
key - keypublic GapList<K1> getAllKeys1()
public java.util.Set<K1> getDistinctKeys1()
public E putByKey1(E elem)
if (containsKey1(elem)) {
removeByKey1(elem);
}
add(elem);
However the method is atomic in the sense that all or none operations are executed.
So if there is already such an element, but adding the new one fails due to a constraint violation,
the old element remains in the list.elem - elementpublic void invalidateKey1(K1 oldKey, K1 newKey, E elem)
oldKey - old key valuenewKey - new key valueelem - element to invalidate (can be null if there are no duplicates with this key)public IFunction<E,K2> getKey2Mapper()
public java.util.Map<K2,E> asMap2()
java.lang.IllegalArgumentException - if the key map cannot be viewed as Mappublic int indexOfKey2(K2 key)
key - keypublic boolean containsKey2(K2 key)
key - keypublic E getByKey2(K2 key)
key - keypublic GapList<E> getAllByKey2(K2 key)
key - keypublic int getCountByKey2(K2 key)
key - keypublic E removeByKey2(K2 key)
key - keypublic GapList<E> removeAllByKey2(K2 key)
key - keypublic GapList<K2> getAllKeys2()
public java.util.Set<K2> getDistinctKeys2()
public E putByKey2(E elem)
if (containsKey2(elem)) {
removeByKey2(elem);
}
add(elem);
However the method is atomic in the sense that all or none operations are executed.
So if there is already such an element, but adding the new one fails due to a constraint violation,
the old element remains in the list.elem - elementpublic void invalidateKey2(K2 oldKey, K2 newKey, E elem)
oldKey - old key valuenewKey - new key valueelem - element to invalidate (can be null if there are no duplicates with this key)public Key2List<E,K1,K2> unmodifiableList()
IListunmodifiableList in class IList<E>