Class Key2Collection.Builder<E,​K1,​K2>

    • Constructor Detail

      • Builder

        public Builder()
        Default constructor.
      • Builder

        Builder​(Key2Collection<E,​K1,​K2> keyColl)
        Private constructor used if extending Key2Collection.
        Parameters:
        keyColl - key collection
    • Method Detail

      • withSetBehavior

        public Key2Collection.Builder<E,​K1,​K2> withSetBehavior​(boolean setBehavior)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Specifies that the collection behaves like a Set on adding elements, i.e. if an element cannot be added due to duplicate or other constraints, no exception is thrown.
        Overrides:
        withSetBehavior in class KeyCollectionImpl.BuilderImpl<E>
        Parameters:
        setBehavior - true to define set behavior (default is false)
        Returns:
        this (fluent interface)
      • withOrderByElem

        public Key2Collection.Builder<E,​K1,​K2> withOrderByElem​(boolean orderBy)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Specifies 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:
        withOrderByElem in class KeyCollectionImpl.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)
      • withElemDuplicates

        public Key2Collection.Builder<E,​K1,​K2> withElemDuplicates​(boolean allowDuplicates,
                                                                              boolean allowDuplicatesNull)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Specify whether duplicates are allowed or not. This method does implicitly create an element set.
        Overrides:
        withElemDuplicates in class KeyCollectionImpl.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 Key2Collection.Builder<E,​K1,​K2> withElemSort​(boolean sort)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Specify 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:
        withElemSort in class KeyCollectionImpl.BuilderImpl<E>
        Parameters:
        sort - true to sorted, false for unsorted (default is false)
        Returns:
        this (fluent interface)
      • withElemSort

        public Key2Collection.Builder<E,​K1,​K2> withElemSort​(java.util.Comparator<? super E> comparator)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Set 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:
        withElemSort in class KeyCollectionImpl.BuilderImpl<E>
        Parameters:
        comparator - comparator to use for sorting (null for natural comparator)
        Returns:
        this (fluent interface)
      • withElemSort

        public Key2Collection.Builder<E,​K1,​K2> withElemSort​(java.util.Comparator<? super E> comparator,
                                                                        boolean sortNullsFirst)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Set 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:
        withElemSort in class KeyCollectionImpl.BuilderImpl<E>
        Parameters:
        comparator - comparator to use for sorting
        sortNullsFirst - true to sort null values first, false for last
        Returns:
        this (fluent interface)
      • withKey1Map

        public Key2Collection.Builder<E,​K1,​K2> withKey1Map​(java.util.function.Function<? super E,​K1> mapper)
        Add key map.
        Parameters:
        mapper - mapper to use
        Returns:
        this (fluent interface)
      • withPrimaryKey1Map

        public Key2Collection.Builder<E,​K1,​K2> withPrimaryKey1Map​(java.util.function.Function<? super E,​K1> mapper)
        Specify this key to be a primary key. This is identical to calling withKey1Map(mapper), withKey1Null(false), and withKey1Duplicates(false).
        Parameters:
        mapper - mapper to use
        Returns:
        this (fluent interface)
      • withUniqueKey1Map

        public Key2Collection.Builder<E,​K1,​K2> withUniqueKey1Map​(java.util.function.Function<? super E,​K1> mapper)
        Specify this key to be a unique key. This is identical to calling withKey1Map(mapper), withKey1Null(true), and withKey1Duplicates(false, true).
        Parameters:
        mapper - mapper to use
        Returns:
        this (fluent interface)
      • withOrderByKey1

        public Key2Collection.Builder<E,​K1,​K2> withOrderByKey1​(boolean orderBy)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Specifies 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:
        withOrderByKey1 in class KeyCollectionImpl.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)
      • withKey1Sort

        public Key2Collection.Builder<E,​K1,​K2> withKey1Sort​(java.util.Comparator<? super K1> comparator)
        Set comparator to use for sorting the key map. Note that this does not automatically sort the list collection, call a withOrderBy method for this.
        Parameters:
        comparator - comparator to use for sorting
        Returns:
        this (fluent interface)
      • withKey1Sort

        public Key2Collection.Builder<E,​K1,​K2> withKey1Sort​(java.util.Comparator<? super K1> comparator,
                                                                        boolean sortNullsFirst)
        Set comparator to use for sorting the key map. Note that this does not automatically sort the list collection, call a withOrderBy method for this.
        Parameters:
        comparator - comparator to use for sorting
        sortNullsFirst - true if null will be sorted first, false for last
        Returns:
        this (fluent interface)
      • withKey2Map

        public Key2Collection.Builder<E,​K1,​K2> withKey2Map​(java.util.function.Function<? super E,​K2> mapper)
        Add key map.
        Parameters:
        mapper - mapper to use
        Returns:
        this (fluent interface)
      • withPrimaryKey2Map

        public Key2Collection.Builder<E,​K1,​K2> withPrimaryKey2Map​(java.util.function.Function<? super E,​K2> mapper)
        Specify this key to be a primary key. This is identical to calling withKey2Map(mapper), withKey2Null(false), and withKey2Duplicates(false).
        Parameters:
        mapper - mapper to use
        Returns:
        this (fluent interface)
      • withUniqueKey2Map

        public Key2Collection.Builder<E,​K1,​K2> withUniqueKey2Map​(java.util.function.Function<? super E,​K2> mapper)
        Specify this key to be a unique key. This is identical to calling withKey2Map(mapper), withKey2Null(true), and withKey2Duplicates(false, true).
        Parameters:
        mapper - mapper to use
        Returns:
        this (fluent interface)
      • withOrderByKey2

        public Key2Collection.Builder<E,​K1,​K2> withOrderByKey2​(boolean orderBy)
        Description copied from class: KeyCollectionImpl.BuilderImpl
        Specifies 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:
        withOrderByKey2 in class KeyCollectionImpl.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)
      • withKey2Sort

        public Key2Collection.Builder<E,​K1,​K2> withKey2Sort​(java.util.Comparator<? super K2> comparator)
        Set comparator to use for sorting the key map. Note that this does not automatically sort the collection itself, call a withOrderBy method for this.
        Parameters:
        comparator - comparator to use for sorting
        Returns:
        this (fluent interface)
      • withKey2Sort

        public Key2Collection.Builder<E,​K1,​K2> withKey2Sort​(java.util.Comparator<? super K2> comparator,
                                                                        boolean sortNullsFirst)
        Set comparator to use for sorting the key map. Note that this does not automatically sort the collection itself, call a withOrderBy method for this.
        Parameters:
        comparator - comparator to use for sorting
        sortNullsFirst - true if null will be sorted first, false for last
        Returns:
        this (fluent interface)