E - type of elements stored in the collectionpublic class KeyCollection<E> extends KeyCollectionImpl<E>
Key1List,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
KeyCollection.Builder<E>
Builder to construct KeyCollection instances.
|
KeyCollectionImpl.BuilderImpl<E>| Modifier | Constructor and Description |
|---|---|
protected |
KeyCollection()
Protected constructor used by builder or derived collections.
|
| Modifier and Type | Method and Description |
|---|---|
KeyCollection<E> |
copy()
Returns a copy of this collection with all its elements.
|
KeyCollection<E> |
crop()
Returns a copy of this collection but without elements.
|
KeyCollection<E> |
getAll(E elem)
Returns all equal elements.
|
protected KeyCollection.Builder<E> |
getBuilder() |
int |
getCount(E elem)
Returns the number of equal elements.
|
java.util.Set<E> |
getDistinct()
Returns all distinct elements in the same order as in the collection.
|
void |
invalidate(E elem)
Invalidate element, i.e. all keys of the element are extracted
again and stored in the key maps.
|
E |
put(E elem)
Adds or replaces element.
|
KeyCollection<E> |
removeAll(E elem)
Removes all equal elements.
|
add, addAll, asSet, clear, clone, contains, containsAll, containsKey, doRemoveByKey, equals, getAllByKey, getAllByKey, getAllKeys, getByKey, getCountByKey, getDistinctKeys, getKeyMapper, hashCode, initClone, invalidateKey, isEmpty, isSorted, iterator, putByKey, remove, removeAll, removeAllByKey, removeAllByKey, removeByKey, retainAll, size, toArray, toArray, toList, toStringprotected KeyCollection()
protected KeyCollection.Builder<E> getBuilder()
public KeyCollection<E> copy()
KeyCollectionImplcopy in class KeyCollectionImpl<E>public KeyCollection<E> crop()
KeyCollectionImplcrop in class KeyCollectionImpl<E>public KeyCollection<E> getAll(E elem)
KeyCollectionImplgetAll in class KeyCollectionImpl<E>elem - elementpublic int getCount(E elem)
KeyCollectionImplgetCount in class KeyCollectionImpl<E>elem - elementpublic KeyCollection<E> removeAll(E elem)
KeyCollectionImplremoveAll in class KeyCollectionImpl<E>elem - elementpublic java.util.Set<E> getDistinct()
KeyCollectionImplgetDistinct in class KeyCollectionImpl<E>public E put(E elem)
KeyCollectionImpl
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.put in class KeyCollectionImpl<E>elem - elementpublic void invalidate(E elem)
KeyCollectionImplinvalidate in class KeyCollectionImpl<E>elem - element to invalidate