Class Index.Builder<V>

  • Type Parameters:
    V - the entry type
    Direct Known Subclasses:
    Index.Mutable.Builder
    Enclosing interface:
    Index<V>

    public static class Index.Builder<V>
    extends java.lang.Object
    Builder of Index instances.
    • Constructor Summary

      Constructors 
      Constructor Description
      Builder()
      Create a new index builder instance.
    • Constructor Detail

      • Builder

        public Builder()
        Create a new index builder instance.
    • Method Detail

      • caseSensitive

        public Index.Builder<V> caseSensitive​(boolean caseSensitive)
        Configure the index to be either case-sensitive or not. Default value is false.
        Parameters:
        caseSensitive - true if the index has to be case-sensitive
        Returns:
        this
      • withAll

        public Index.Builder<V> withAll​(V[] values,
                                        java.util.function.Function<V,​java.lang.String> keyFunction)
        Configure some pre-existing entries.
        Parameters:
        values - an array of values
        keyFunction - a Function that generates the key of each entry of the values array
        Returns:
        this
      • withAll

        public Index.Builder<V> withAll​(java.util.function.Supplier<java.util.Map<java.lang.String,​V>> entriesSupplier)
        Configure some pre-existing entries.
        Parameters:
        entriesSupplier - a Map Supplier of entries
        Returns:
        this
      • with

        public Index.Builder<V> with​(V value)
        Configure a pre-existing entry with a key that is the toString() representation of the value.
        Parameters:
        value - The value
        Returns:
        this
      • with

        public Index.Builder<V> with​(java.lang.String key,
                                     V value)
        Configure a pre-existing entry.
        Parameters:
        key - The key
        value - The value for the key string
        Returns:
        this
      • build

        public Index<V> build()
        Build a Index instance.
        Returns:
        a Index instance.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object