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