Class Key1Set<E,K>
- java.lang.Object
-
- org.magicwerk.brownies.collections.KeyCollectionImpl<E>
-
- org.magicwerk.brownies.collections.Key1Collection<E,K>
-
- org.magicwerk.brownies.collections.Key1Set<E,K>
-
- Type Parameters:
E
- type of elements stored in the set
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
,ICollection<E>
public class Key1Set<E,K> extends Key1Collection<E,K> implements java.util.Set<E>
Key1Set implements a set. The elements allowed in the set can be constraint (null/duplicate values).- See Also:
Key1Collection
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Key1Set.Builder<E,K>
Builder to construct Key1Set 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
Constructors Modifier Constructor Description protected
Key1Set()
Protected constructor used by builder or derived collections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Key1Set<E,K>
copy()
Returns a copy of this collection with all its elements.Key1Set<E,K>
crop()
Returns a copy of this collection but without elements.Key1Set<E,K>
filter(java.util.function.Predicate<? super E> filter)
Create a new collection by applying the specified filter to all elements.Key1Set<E,K>
getAll(E elem)
Returns all equal elements.Key1Set<E,K>
getAllByKey1(K key)
Returns all elements with specified key.protected Key1Set.Builder<E,K>
getBuilder()
-
Methods inherited from class org.magicwerk.brownies.collections.Key1Collection
asMap1, containsKey1, getAllKeys1, getByKey1, getCountByKey1, getDistinctKeys1, getKey1Mapper, invalidate, invalidateKey1, put, putByKey1, removeAll, removeAllByKey1, removeByKey1
-
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 org.magicwerk.brownies.collections.ICollection
containsIf, countIf, getFirst, getFirstOrNull, getIf, getSingle, getSingleOrNull
-
-
-
-
Method Detail
-
getBuilder
protected Key1Set.Builder<E,K> getBuilder()
- Overrides:
getBuilder
in classKey1Collection<E,K>
- Returns:
- builder to use in extending classes
-
copy
public Key1Set<E,K> 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 classKey1Collection<E,K>
- Returns:
- a copy of this collection
-
crop
public Key1Set<E,K> 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 classKey1Collection<E,K>
- Returns:
- an empty copy of this collection
-
getAll
public Key1Set<E,K> getAll(E elem)
Description copied from class:KeyCollectionImpl
Returns all equal elements.- Overrides:
getAll
in classKey1Collection<E,K>
- Parameters:
elem
- element- Returns:
- all equal elements (never null)
-
getAllByKey1
public Key1Set<E,K> getAllByKey1(K key)
Description copied from class:Key1Collection
Returns all elements with specified key.- Overrides:
getAllByKey1
in classKey1Collection<E,K>
- Parameters:
key
- key- Returns:
- all elements with specified key (never null)
-
filter
public Key1Set<E,K> filter(java.util.function.Predicate<? super E> 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 classKey1Collection<E,K>
- Parameters:
filter
- filter predicate- Returns:
- created list
-
-