public static class KeySet.Builder<E> extends KeyCollection.Builder<E>
KeyCollectionImpl.BuilderImpl.KeyMapBuilder<E,K>
Constructor and Description |
---|
Builder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
KeySet<E> |
build() |
KeySet.Builder<E> |
withAfterDeleteTrigger(java.util.function.Consumer<E> trigger)
Specify delete trigger.
|
KeySet.Builder<E> |
withAfterInsertTrigger(java.util.function.Consumer<E> trigger)
Specify insert trigger.
|
KeySet.Builder<E> |
withBeforeDeleteTrigger(java.util.function.Consumer<E> trigger)
Specify delete trigger.
|
KeySet.Builder<E> |
withBeforeInsertTrigger(java.util.function.Consumer<E> trigger)
Specify insert trigger.
|
KeySet.Builder<E> |
withCapacity(int capacity)
Specify initial capacity.
|
KeySet.Builder<E> |
withConstraint(java.util.function.Predicate<E> constraint)
Specify element constraint.
|
KeySet.Builder<E> |
withContent(java.util.Collection<? extends E> elements)
Specify elements added to the collection upon creation.
|
KeySet.Builder<E> |
withContent(E... elements)
Specify elements added to the collection upon creation.
|
KeySet.Builder<E> |
withElemCount(boolean count)
Specifies that the collection only counts the number of occurrences
of equal elements, but does not store the elements themselves.
|
KeySet.Builder<E> |
withElemDuplicates(boolean allowDuplicates)
Specify whether duplicates are allowed or not.
|
KeySet.Builder<E> |
withElemDuplicates(boolean allowDuplicates,
boolean allowDuplicatesNull)
Specify whether duplicates are allowed or not.
|
KeySet.Builder<E> |
withElemNull(boolean allowNull)
Specifies whether null elements are allowed or not.
|
KeySet.Builder<E> |
withElemSet()
Add element map (with ident mapper).
|
KeySet.Builder<E> |
withElemSort(boolean sort)
Specify that the element set should be sorted using the natural comparator.
|
KeySet.Builder<E> |
withElemSort(java.util.Comparator<? super E> comparator)
Set comparator to use for sorting the element set.
|
KeySet.Builder<E> |
withElemSort(java.util.Comparator<? super E> comparator,
boolean sortNullsFirst)
Set comparator to use for sorting the element set.
|
KeySet.Builder<E> |
withMaxSize(int maxSize)
Specify maximum size of collection.
|
KeySet.Builder<E> |
withNull(boolean allowNull)
Specifies whether null elements are allowed or not.
|
KeySet.Builder<E> |
withOrderByElem(boolean orderBy)
Specifies that the collection will have the order of the element set.
|
KeySet.Builder<E> |
withPrimaryElem()
Specify the element to be a primary key.
|
KeySet.Builder<E> |
withSetBehavior(boolean setBehavior)
Specifies that the collection behaves like a
Set on adding elements, i.e. |
KeySet.Builder<E> |
withUniqueElem()
Specify the element to be a unique key.
|
withKey1Duplicates, withKey1Duplicates, withKey1Null, withKey1Sort, withKey2Duplicates, withKey2Duplicates, withKey2Null, withKey2Sort, withKeyDuplicates, withKeyMap, withKeyNull, withKeySort, withKeySort, withKeySort, withListBig, withListType, withOrderByElem, withOrderByKey, withOrderByKey, withOrderByKey1, withOrderByKey1, withOrderByKey2, withOrderByKey2, withPrimaryKeyMap, withUniqueKeyMap, withWindowSize
public KeySet<E> build()
build
in class KeyCollection.Builder<E>
public KeySet.Builder<E> withSetBehavior(boolean setBehavior)
Set
on adding elements, i.e.
if an element cannot be added due to duplicate or other constraints, no exception is thrown.
Note that KeySet
only supports set behavior, so an exception is thrown if the argument is false.
withSetBehavior
in class KeyCollection.Builder<E>
setBehavior
- true to define set behavior (default is false)public KeySet.Builder<E> withElemDuplicates(boolean allowDuplicates)
Note that KeySet
does not support duplicates, so an exception is thrown if the argument is true.
withElemDuplicates
in class KeyCollection.Builder<E>
allowDuplicates
- true to allow duplicates (default is true)public KeySet.Builder<E> withElemDuplicates(boolean allowDuplicates, boolean allowDuplicatesNull)
Note that KeySet
does not support duplicates, so an exception is thrown if any argument is true.
withElemDuplicates
in class KeyCollection.Builder<E>
allowDuplicates
- true to allow duplicates (default is true)allowDuplicatesNull
- true to allow duplicate null values (default is true)public KeySet.Builder<E> withNull(boolean allowNull)
KeyCollectionImpl.BuilderImpl
KeyCollectionImpl.BuilderImpl.withElemNull(boolean)
does.withNull
in class KeyCollection.Builder<E>
allowNull
- true to allow null elements (default), false to disallowpublic KeySet.Builder<E> withConstraint(java.util.function.Predicate<E> constraint)
KeyCollectionImpl.BuilderImpl
withConstraint
in class KeyCollection.Builder<E>
constraint
- constraint element must satisfy, null for none (default)public KeySet.Builder<E> withBeforeInsertTrigger(java.util.function.Consumer<E> trigger)
KeyCollectionImpl.BuilderImpl
withBeforeInsertTrigger
in class KeyCollection.Builder<E>
trigger
- insert trigger method, null for none (default)public KeySet.Builder<E> withAfterInsertTrigger(java.util.function.Consumer<E> trigger)
KeyCollectionImpl.BuilderImpl
withAfterInsertTrigger
in class KeyCollection.Builder<E>
trigger
- insert trigger method, null for none (default)public KeySet.Builder<E> withBeforeDeleteTrigger(java.util.function.Consumer<E> trigger)
KeyCollectionImpl.BuilderImpl
withBeforeDeleteTrigger
in class KeyCollection.Builder<E>
trigger
- delete trigger method, null for none (default)public KeySet.Builder<E> withAfterDeleteTrigger(java.util.function.Consumer<E> trigger)
KeyCollectionImpl.BuilderImpl
withAfterDeleteTrigger
in class KeyCollection.Builder<E>
trigger
- delete trigger method, null for none (default)public KeySet.Builder<E> withCapacity(int capacity)
KeyCollectionImpl.BuilderImpl
withCapacity
in class KeyCollection.Builder<E>
capacity
- initial capacitypublic KeySet.Builder<E> withContent(java.util.Collection<? extends E> elements)
KeyCollectionImpl.BuilderImpl
withContent
in class KeyCollection.Builder<E>
elements
- initial elementspublic KeySet.Builder<E> withContent(E... elements)
KeyCollectionImpl.BuilderImpl
withContent
in class KeyCollection.Builder<E>
elements
- initial elementspublic KeySet.Builder<E> withMaxSize(int maxSize)
KeyCollectionImpl.BuilderImpl
withMaxSize
in class KeyCollection.Builder<E>
maxSize
- maximum sizepublic KeySet.Builder<E> withElemCount(boolean count)
Note that KeySet
does not support duplicates, so an exception is thrown if the argument is true.
withElemCount
in class KeyCollection.Builder<E>
count
- true to count only number of occurrences (default is false)public KeySet.Builder<E> withElemSet()
Note that a KeyCollection
always has an element set, so this call is not necessary.
Note that a KeySet
always has an element set, so this call is not necessary.
withElemSet
in class KeyCollection.Builder<E>
public KeySet.Builder<E> withOrderByElem(boolean orderBy)
KeyCollectionImpl.BuilderImpl
withOrderByElem
in class KeyCollection.Builder<E>
orderBy
- if true the collection will have the order of the element set
(default is false, only one key map or the element set can have the order by option set)public KeySet.Builder<E> withElemNull(boolean allowNull)
KeyCollectionImpl.BuilderImpl
KeyCollectionImpl.BuilderImpl.withNull(boolean)
does not.withElemNull
in class KeyCollection.Builder<E>
allowNull
- true to allow null elements, false to disallow (default is true)public KeySet.Builder<E> withElemSort(boolean sort)
KeyCollectionImpl.BuilderImpl
withElemSort
in class KeyCollection.Builder<E>
sort
- true to sorted, false for unsorted (default is false)public KeySet.Builder<E> withElemSort(java.util.Comparator<? super E> comparator)
KeyCollectionImpl.BuilderImpl
withElemSort
in class KeyCollection.Builder<E>
comparator
- comparator to use for sorting (null for natural comparator)public KeySet.Builder<E> withElemSort(java.util.Comparator<? super E> comparator, boolean sortNullsFirst)
KeyCollectionImpl.BuilderImpl
withElemSort
in class KeyCollection.Builder<E>
comparator
- comparator to use for sortingsortNullsFirst
- true to sort null values first, false for lastpublic KeySet.Builder<E> withPrimaryElem()
withElemNull(false) and withElemDuplicates(false)
.
Note that a Key2Set
always has an element set, so this call is not necessary.
withPrimaryElem
in class KeyCollection.Builder<E>
public KeySet.Builder<E> withUniqueElem()
withElemNull(true) and withElemDuplicates(false, true)
.
Note that a KeySet
always has an element set, so an exception is thrown.
withUniqueElem
in class KeyCollection.Builder<E>