Class Key2Set<E,K1,K2>
java.lang.Object
org.magicwerk.brownies.collections.KeyCollectionImpl<E>
org.magicwerk.brownies.collections.Key2Collection<E,K1,K2>
org.magicwerk.brownies.collections.Key2Set<E,K1,K2>
- Type Parameters:
E
- type of elements stored in the set
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<E>
,Collection<E>
,Set<E>
,ICollection<E>
Key2Set implements a set.
The elements allowed in the set can be constraint (null/duplicate values).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder to construct Key2Set instances.Nested classes/interfaces inherited from class org.magicwerk.brownies.collections.KeyCollectionImpl
KeyCollectionImpl.BuilderImpl<E>, KeyCollectionImpl.KeyMap<E,
K>, KeyCollectionImpl.KeyMapList<E> -
Field Summary
Fields inherited from class org.magicwerk.brownies.collections.KeyCollectionImpl
afterDeleteTrigger, afterInsertTrigger, allowNullElem, beforeDeleteTrigger, beforeInsertTrigger, constraint, keyList, keyMaps, maxSize, movingWindow, orderByKey, setBehavior, size, SYMBOL_ADDED, SYMBOL_ERROR_NULL_KEY, SYMBOL_NOT_ADDED
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Key2Set()
Protected constructor used by builder or derived collections. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Returns a copy of this collection with all its elements.crop()
Returns a copy of this collection but without elements.Create a new collection by applying the specified filter to all elements.Returns all equal elements.getAllByKey1
(K1 key) Returns all elements with specified key.getAllByKey2
(K2 key) Returns all elements with specified key.protected Key2Set.Builder
<E, K1, K2> Methods inherited from class org.magicwerk.brownies.collections.Key2Collection
asMap1, asMap2, containsKey1, containsKey2, getAllKeys1, getAllKeys2, getByKey1, getByKey2, getCountByKey1, getCountByKey2, getDistinctKeys1, getDistinctKeys2, getKey1Mapper, getKey2Mapper, invalidate, invalidateKey1, invalidateKey2, put, putByKey1, putByKey2, removeAll, removeAllByKey1, removeAllByKey2, removeByKey1, removeByKey2
Methods inherited from class org.magicwerk.brownies.collections.KeyCollectionImpl
add, addAll, addSorted, addUnsorted, asSet, binarySearchSorted, checkAddElem, checkAsMap, checkAsSet, checkElemAllowed, checkIndex, checkKeyMap, clear, clone, contains, containsAll, containsKey, debugCheck, doAdd, doAdd, doAddThrow, doInvalidateKey, doRemove, doRemoveByKey, equals, errorConstraintElement, errorDuplicateKey, errorInvalidateNotSupported, errorInvalidData, errorInvalidIndex, errorInvalidSetBehavior, errorInvaliDuplicates, errorMaxSize, errorNullElement, errorNullKey, filterMap, flatMap, getAllByKey, getAllByKey, getAllKeys, getByKey, getCount, getCountByKey, getDistinct, getDistinctKeys, getElemSortComparator, getKey, getKeyMap, getKeyMapper, hasElemSet, hashCode, indexOfSorted, initClone, initCopy, initCrop, invalidateKey, isContainsFast, isEmpty, isSorted, isSortedByElem, iterator, map, mapFilter, putByKey, remove, remove, removeAll, removeAllByKey, removeAllByKey, removeByKey, retainAll, setSorted, size, toArray, toArray, toList, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.magicwerk.brownies.collections.ICollection
containsIf, countIf, getFirst, getFirstOrNull, getIf, getSingle, getSingleOrNull
-
Constructor Details
-
Key2Set
protected Key2Set()Protected constructor used by builder or derived collections.
-
-
Method Details
-
getBuilder
- Overrides:
getBuilder
in classKey2Collection<E,
K1, K2> - Returns:
- builder to use in extending classes
-
copy
Description copied from class:KeyCollectionImpl
Returns a copy of this collection with all its elements. The new collection will use the same comparator, ordering, etc.- Specified by:
copy
in interfaceICollection<E>
- Overrides:
copy
in classKey2Collection<E,
K1, K2> - Returns:
- a copy of this collection
-
crop
Description copied from class:KeyCollectionImpl
Returns a copy of this collection but without elements. The new collection will use the same comparator, ordering, etc.- Specified by:
crop
in interfaceICollection<E>
- Overrides:
crop
in classKey2Collection<E,
K1, K2> - Returns:
- an empty copy of this collection
-
getAll
Description copied from class:KeyCollectionImpl
Returns all equal elements.- Overrides:
getAll
in classKey2Collection<E,
K1, K2> - Parameters:
elem
- element- Returns:
- all equal elements (never null)
-
getAllByKey1
Description copied from class:Key2Collection
Returns all elements with specified key.- Overrides:
getAllByKey1
in classKey2Collection<E,
K1, K2> - Parameters:
key
- key- Returns:
- all elements with specified key (never null)
-
getAllByKey2
Description copied from class:Key2Collection
Returns all elements with specified key.- Overrides:
getAllByKey2
in classKey2Collection<E,
K1, K2> - Parameters:
key
- key- Returns:
- all elements with specified key (never null)
-
filter
Description copied from interface:ICollection
Create a new collection by applying the specified filter to all elements. The returned collection has the same type as the original one.- Specified by:
filter
in interfaceICollection<E>
- Overrides:
filter
in classKey2Collection<E,
K1, K2> - Parameters:
filter
- filter predicate- Returns:
- created list
-