Class Key1List.Builder<E,K>
- java.lang.Object
-
- org.magicwerk.brownies.collections.KeyCollectionImpl.BuilderImpl<E>
-
- org.magicwerk.brownies.collections.Key1List.Builder<E,K>
-
public static class Key1List.Builder<E,K> extends KeyCollectionImpl.BuilderImpl<E>
Builder to construct Key1List instances.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.magicwerk.brownies.collections.KeyCollectionImpl.BuilderImpl
KeyCollectionImpl.BuilderImpl.KeyMapBuilder<E,K>
-
-
Field Summary
-
Fields inherited from class org.magicwerk.brownies.collections.KeyCollectionImpl.BuilderImpl
afterDeleteTrigger, afterInsertTrigger, allowNullElem, array, beforeDeleteTrigger, beforeInsertTrigger, capacity, collection, constraint, count, keyColl, keyList, keyMapBuilders, maxSize, movingWindow, setBehavior, useBigList
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Key1List<E,K>build()Key1List.Builder<E,K>withAfterDeleteTrigger(java.util.function.Consumer<E> trigger)Specify delete trigger.Key1List.Builder<E,K>withAfterInsertTrigger(java.util.function.Consumer<E> trigger)Specify insert trigger.Key1List.Builder<E,K>withBeforeDeleteTrigger(java.util.function.Consumer<E> trigger)Specify delete trigger.Key1List.Builder<E,K>withBeforeInsertTrigger(java.util.function.Consumer<E> trigger)Specify insert trigger.Key1List.Builder<E,K>withCapacity(int capacity)Specify initial capacity.Key1List.Builder<E,K>withConstraint(java.util.function.Predicate<E> constraint)Specify element constraint.Key1List.Builder<E,K>withContent(E... elements)Specify elements added to the collection upon creation.Key1List.Builder<E,K>withContent(java.util.Collection<? extends E> elements)Specify elements added to the collection upon creation.Key1List.Builder<E,K>withElemDuplicates(boolean allowDuplicates)Specify whether duplicates are allowed or not.Key1List.Builder<E,K>withElemDuplicates(boolean allowDuplicates, boolean allowDuplicatesNull)Specify whether duplicates are allowed or not.Key1List.Builder<E,K>withElemNull(boolean allowNull)Specifies whether null elements are allowed or not.Key1List.Builder<E,K>withElemSet()Add element map (with ident mapper).Key1List.Builder<E,K>withElemSort(boolean sort)Specify that the element set should be sorted using the natural comparator.Key1List.Builder<E,K>withElemSort(java.util.Comparator<? super E> comparator)Set comparator to use for sorting the element set.Key1List.Builder<E,K>withElemSort(java.util.Comparator<? super E> comparator, boolean sortNullsFirst)Set comparator to use for sorting the element set.Key1List.Builder<E,K>withKey1Duplicates(boolean allowDuplicates)Specify whether duplicates are allowed or not.Key1List.Builder<E,K>withKey1Duplicates(boolean allowDuplicates, boolean allowDuplicatesNull)Specify whether duplicates are allowed or not.Key1List.Builder<E,K>withKey1Map(java.util.function.Function<? super E,K> mapper)Add key map.Key1List.Builder<E,K>withKey1Null(boolean allowNull)Specify whether null elements are allowed or not.Key1List.Builder<E,K>withKey1Sort(boolean sort)Set comparator to use for sorting the key map.Key1List.Builder<E,K>withKey1Sort(java.util.Comparator<? super K> comparator)Set comparator to use for sorting the key map.Key1List.Builder<E,K>withKey1Sort(java.util.Comparator<? super K> comparator, boolean sortNullsFirst)Set comparator to use for sorting the key map.Key1List.Builder<E,K>withListBig(boolean bigList)Specify whether list should be stored in an instance of BigList or GapList.Key1List.Builder<E,K>withMaxSize(int maxSize)Specify maximum size of collection.Key1List.Builder<E,K>withNull(boolean allowNull)Specifies whether null elements are allowed or not.Key1List.Builder<E,K>withOrderByElem(boolean orderBy)Specifies that the collection will have the order of the element set.Key1List.Builder<E,K>withOrderByKey1(boolean orderBy)Specifies that the collection will have the order of the key map.Key1List.Builder<E,K>withOrderByKey1(java.lang.Class<?> type)Specifies that the list will have the order of the key map.Key1List.Builder<E,K>withPrimaryElem()Specify the element to be a primary key.Key1List.Builder<E,K>withPrimaryKey1Map(java.util.function.Function<? super E,K> mapper)Specify this key to be a primary key.Key1List.Builder<E,K>withUniqueElem()Specify the element to be a unique key.Key1List.Builder<E,K>withUniqueKey1Map(java.util.function.Function<? super E,K> mapper)Specify this key to be a unique key.Key1List.Builder<E,K>withWindowSize(int maxSize)Specify maximum window size of collection.-
Methods inherited from class org.magicwerk.brownies.collections.KeyCollectionImpl.BuilderImpl
build, buildKeyMap, getKeyMapBuilder, hasElemMapBuilder, init, init, initKeyMapBuilder, initList, isFalse, isTrue, withElemCount, withKey2Duplicates, withKey2Duplicates, withKey2Null, withKey2Sort, withKeyDuplicates, withKeyMap, withKeyNull, withKeySort, withKeySort, withKeySort, withListType, withOrderByElem, withOrderByKey, withOrderByKey, withOrderByKey2, withOrderByKey2, withPrimaryKeyMap, withSetBehavior, withUniqueKeyMap
-
-
-
-
Method Detail
-
withNull
public Key1List.Builder<E,K> withNull(boolean allowNull)
Description copied from class:KeyCollectionImpl.BuilderImplSpecifies whether null elements are allowed or not. A null element will have null keys. This method does not implicitly create an element set, where asKeyCollectionImpl.BuilderImpl.withElemNull(boolean)does.- Overrides:
withNullin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowNull- true to allow null elements (default), false to disallow- Returns:
- this (fluent interfaces)
-
withConstraint
public Key1List.Builder<E,K> withConstraint(java.util.function.Predicate<E> constraint)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify element constraint.- Overrides:
withConstraintin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
constraint- constraint element must satisfy, null for none (default)- Returns:
- this (fluent interface)
-
withBeforeInsertTrigger
public Key1List.Builder<E,K> withBeforeInsertTrigger(java.util.function.Consumer<E> trigger)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify insert trigger.- Overrides:
withBeforeInsertTriggerin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
trigger- insert trigger method, null for none (default)- Returns:
- this (fluent interface)
-
withAfterInsertTrigger
public Key1List.Builder<E,K> withAfterInsertTrigger(java.util.function.Consumer<E> trigger)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify insert trigger.- Overrides:
withAfterInsertTriggerin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
trigger- insert trigger method, null for none (default)- Returns:
- this (fluent interface)
-
withBeforeDeleteTrigger
public Key1List.Builder<E,K> withBeforeDeleteTrigger(java.util.function.Consumer<E> trigger)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify delete trigger.- Overrides:
withBeforeDeleteTriggerin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
trigger- delete trigger method, null for none (default)- Returns:
- this (fluent interface)
-
withAfterDeleteTrigger
public Key1List.Builder<E,K> withAfterDeleteTrigger(java.util.function.Consumer<E> trigger)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify delete trigger.- Overrides:
withAfterDeleteTriggerin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
trigger- delete trigger method, null for none (default)- Returns:
- this (fluent interface)
-
withCapacity
public Key1List.Builder<E,K> withCapacity(int capacity)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify initial capacity.- Overrides:
withCapacityin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
capacity- initial capacity- Returns:
- this (fluent interface)
-
withContent
public Key1List.Builder<E,K> withContent(java.util.Collection<? extends E> elements)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify elements added to the collection upon creation.- Overrides:
withContentin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
elements- initial elements- Returns:
- this (fluent interface)
-
withContent
public Key1List.Builder<E,K> withContent(E... elements)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify elements added to the collection upon creation.- Overrides:
withContentin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
elements- initial elements- Returns:
- this (fluent interface)
-
withMaxSize
public Key1List.Builder<E,K> withMaxSize(int maxSize)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify maximum size of collection. If an attempt is made to add more elements, an exception is thrown.- Overrides:
withMaxSizein classKeyCollectionImpl.BuilderImpl<E>- Parameters:
maxSize- maximum size- Returns:
- this (fluent interface)
-
withWindowSize
public Key1List.Builder<E,K> withWindowSize(int maxSize)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify maximum window size of collection. If an attempt is made to add and additional element, the first element is removed.- Overrides:
withWindowSizein classKeyCollectionImpl.BuilderImpl<E>- Parameters:
maxSize- maximum window size- Returns:
- this (fluent interface)
-
withListBig
public Key1List.Builder<E,K> withListBig(boolean bigList)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify whether list should be stored in an instance of BigList or GapList.- Overrides:
withListBigin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
bigList- true to store list content in an instance of BigList, false for GapList- Returns:
- this (fluent interface)
-
withElemSet
public Key1List.Builder<E,K> withElemSet()
Description copied from class:KeyCollectionImpl.BuilderImplAdd element map (with ident mapper).- Overrides:
withElemSetin classKeyCollectionImpl.BuilderImpl<E>- Returns:
- this (fluent interface)
-
withOrderByElem
public Key1List.Builder<E,K> withOrderByElem(boolean orderBy)
Description copied from class:KeyCollectionImpl.BuilderImplSpecifies that the collection will have the order of the element set. The element set must be sorted, if no sort order has been defined, the natural comparator will be used. If the set allows null values, the used comparator will sort them last.- Overrides:
withOrderByElemin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
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)- Returns:
- this (fluent interface)
-
withElemNull
public Key1List.Builder<E,K> withElemNull(boolean allowNull)
Description copied from class:KeyCollectionImpl.BuilderImplSpecifies whether null elements are allowed or not. A null element will have null keys. This method does implicitly create an element set, where asKeyCollectionImpl.BuilderImpl.withNull(boolean)does not.- Overrides:
withElemNullin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowNull- true to allow null elements, false to disallow (default is true)- Returns:
- this (fluent interfaces)
-
withElemDuplicates
public Key1List.Builder<E,K> withElemDuplicates(boolean allowDuplicates)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify whether duplicates are allowed or not. This method does implicitly create an element set.- Overrides:
withElemDuplicatesin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowDuplicates- true to allow duplicates (default is true)- Returns:
- this (fluent interfaces)
-
withElemDuplicates
public Key1List.Builder<E,K> withElemDuplicates(boolean allowDuplicates, boolean allowDuplicatesNull)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify whether duplicates are allowed or not. This method does implicitly create an element set.- Overrides:
withElemDuplicatesin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowDuplicates- true to allow duplicates (default is true)allowDuplicatesNull- true to allow duplicate null values (default is true)- Returns:
- this (fluent interfaces)
-
withElemSort
public Key1List.Builder<E,K> withElemSort(boolean sort)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify that the element set should be sorted using the natural comparator. If the collection supports null values, they are sorted last. This method does implicitly create an element set. Note that this does not automatically sort the collection itself, call a withOrderBy method for this.- Overrides:
withElemSortin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
sort- true to sorted, false for unsorted (default is false)- Returns:
- this (fluent interface)
-
withElemSort
public Key1List.Builder<E,K> withElemSort(java.util.Comparator<? super E> comparator)
Description copied from class:KeyCollectionImpl.BuilderImplSet comparator to use for sorting the element set. If the collection allows null values, the comparator must be able to compare null values. If the comparator does not support null values, use withElemSort(Comparator, boolean) to explicitly specify how null values should be sorted. This method does implicitly create an element set. Note that this does not automatically sort the collection itself, call a withOrderBy method for this.- Overrides:
withElemSortin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
comparator- comparator to use for sorting (null for natural comparator)- Returns:
- this (fluent interface)
-
withElemSort
public Key1List.Builder<E,K> withElemSort(java.util.Comparator<? super E> comparator, boolean sortNullsFirst)
Description copied from class:KeyCollectionImpl.BuilderImplSet comparator to use for sorting the element set. This method should be used if the collection can contain null values, but the comparator is not able to handle them. The parameter sortNullsFirst determine how the null values should be sorted. This method does implicitly create an element set.- Overrides:
withElemSortin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
comparator- comparator to use for sortingsortNullsFirst- true to sort null values first, false for last- Returns:
- this (fluent interface)
-
withPrimaryElem
public Key1List.Builder<E,K> withPrimaryElem()
Description copied from class:KeyCollectionImpl.BuilderImplSpecify the element to be a primary key. This is identical to callingwithElemNull(false) and withElemDuplicates(false).- Overrides:
withPrimaryElemin classKeyCollectionImpl.BuilderImpl<E>- Returns:
- this (fluent interface)
-
withUniqueElem
public Key1List.Builder<E,K> withUniqueElem()
Description copied from class:KeyCollectionImpl.BuilderImplSpecify the element to be a unique key. This is identical to callingwithElemNull(true) and withElemDuplicates(false, true).- Overrides:
withUniqueElemin classKeyCollectionImpl.BuilderImpl<E>- Returns:
- this (fluent interface)
-
withKey1Map
public Key1List.Builder<E,K> withKey1Map(java.util.function.Function<? super E,K> mapper)
Add key map.- Parameters:
mapper- mapper to use- Returns:
- this (fluent interface)
-
withPrimaryKey1Map
public Key1List.Builder<E,K> withPrimaryKey1Map(java.util.function.Function<? super E,K> mapper)
Specify this key to be a primary key. This is identical to callingwithKey1Map(mapper), withKey1Null(false), and withKey1Duplicates(false).- Parameters:
mapper- mapper to use- Returns:
- this (fluent interface)
-
withUniqueKey1Map
public Key1List.Builder<E,K> withUniqueKey1Map(java.util.function.Function<? super E,K> mapper)
Specify this key to be a unique key. This is identical to callingwithKey1Map(mapper), withKey1Null(true), and withKey1Duplicates(false, true).- Parameters:
mapper- mapper to use- Returns:
- this (fluent interface)
-
withOrderByKey1
public Key1List.Builder<E,K> withOrderByKey1(boolean orderBy)
Description copied from class:KeyCollectionImpl.BuilderImplSpecifies that the collection will have the order of the key map. The key map must be sorted, if no sort order has been defined, the natural comparator will be used. If the map allows null values, the used comparator will sort them last.- Overrides:
withOrderByKey1in classKeyCollectionImpl.BuilderImpl<E>- Parameters:
orderBy- if true the collection will have the order of the key map (default is false, only one key map or the element set can have the order by option set)- Returns:
- this (fluent interface)
-
withOrderByKey1
public Key1List.Builder<E,K> withOrderByKey1(java.lang.Class<?> type)
Description copied from class:KeyCollectionImpl.BuilderImplSpecifies that the list will have the order of the key map. The key map will store values of the primitive type specified likeint. The key map will be sorted using the natural comparator and no null values are allowed.- Overrides:
withOrderByKey1in classKeyCollectionImpl.BuilderImpl<E>- Parameters:
type- primitive type to use for key map (only one key map or the element set can have the order by option set)- Returns:
- this (fluent interface)
-
withKey1Null
public Key1List.Builder<E,K> withKey1Null(boolean allowNull)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify whether null elements are allowed or not. A null element will have a null key.- Overrides:
withKey1Nullin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowNull- true to allow null elements, false to disallow- Returns:
- this (fluent interfaces)
-
withKey1Duplicates
public Key1List.Builder<E,K> withKey1Duplicates(boolean allowDuplicates)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify whether duplicates are allowed or not.- Overrides:
withKey1Duplicatesin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowDuplicates- true to allow duplicates- Returns:
- this (fluent interfaces)
-
withKey1Duplicates
public Key1List.Builder<E,K> withKey1Duplicates(boolean allowDuplicates, boolean allowDuplicatesNull)
Description copied from class:KeyCollectionImpl.BuilderImplSpecify whether duplicates are allowed or not.- Overrides:
withKey1Duplicatesin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
allowDuplicates- true to allow duplicatesallowDuplicatesNull- true to allow duplicate null values- Returns:
- this (fluent interfaces)
-
withKey1Sort
public Key1List.Builder<E,K> withKey1Sort(boolean sort)
Description copied from class:KeyCollectionImpl.BuilderImplSet comparator to use for sorting the key map. Note that this does not automatically sort the list itself, call a withOrderBy method for this.- Overrides:
withKey1Sortin classKeyCollectionImpl.BuilderImpl<E>- Parameters:
sort- true to sort key map- Returns:
- this (fluent interface)
-
withKey1Sort
public Key1List.Builder<E,K> withKey1Sort(java.util.Comparator<? super K> comparator)
Set comparator to use for sorting the key map. Note that this does not automatically sort the list itself, call a withOrderBy method for this.- Parameters:
comparator- comparator to use for sorting- Returns:
- this (fluent interface)
-
withKey1Sort
public Key1List.Builder<E,K> withKey1Sort(java.util.Comparator<? super K> comparator, boolean sortNullsFirst)
Set comparator to use for sorting the key map. Note that this does not automatically sort the list itself, call a withOrderBy method for this.- Parameters:
comparator- comparator to use for sortingsortNullsFirst- true if null will be sorted first, false for last- Returns:
- this (fluent interface)
-
-