Class StringPrefixMap<V extends Serializable>

    • Constructor Detail

      • StringPrefixMap

        public StringPrefixMap​(boolean caseSensitive)
    • Method Detail

      • configureKryo

        public static void configureKryo​(Object kryoInstance)
        This is used to configure the provided Kryo instance if Kryo serialization is desired. The expected type here is Object because otherwise the Kryo library becomes a mandatory dependency on any project that uses Yauaa.
        Parameters:
        kryoInstance - The instance of com.esotericsoftware.kryo.Kryo that needs to be configured.
      • containsPrefix

        public boolean containsPrefix​(String prefix)
        Description copied from interface: PrefixMap

        Returns true if this map contains an exact mapping for the specified prefix.

        Note that implementations may be constructed to match either case sensitive or case insensitive.

        Specified by:
        containsPrefix in interface PrefixMap<V extends Serializable>
        Parameters:
        prefix - prefix whose presence in this prefixmap is to be checked
        Returns:
        true if this map contains an the exact mapping for the specified prefix.
      • put

        public V put​(String prefix,
                     V value)
        Description copied from interface: PrefixMap

        Stored the specified value as the result for the specified prefix.

        If for the specified prefix previously a value was present then the old value is replaced with the new value and the old value is returned.

        Note that implementations may be constructed to store this value for either case sensitive or case insensitive matching during retrieval.

        Specified by:
        put in interface Map<String,​V extends Serializable>
        Specified by:
        put in interface PrefixMap<V extends Serializable>
        Parameters:
        prefix - prefix with which the specified value is to be associated
        value - value to be associated with the specified prefix
        Returns:
        the previous value of the specified prefix, or null if there was no mapping for prefix.
      • remove

        public V remove​(String prefix)
        Description copied from interface: PrefixMap

        Removes the mapping for a prefix if present.

        Note that implementations may be constructed to remove either case sensitive (only this exact value) or case insensitive (all case variations).

        Specified by:
        remove in interface PrefixMap<V extends Serializable>
        Parameters:
        prefix - prefix whose mapping is to be removed from the prefixmap
        Returns:
        the previous value associated with prefix (may be null).
      • get

        public V get​(String prefix)
        Description copied from interface: PrefixMap

        Return the value of the exact matching prefix.

        The value returned is the stored prefix for which is true: input.equals(prefix).

        Note that implementations may be constructed to match either case sensitive or case insensitive.

        Specified by:
        get in interface PrefixMap<V extends Serializable>
        Parameters:
        prefix - The string for which we need value of the stored prefix
        Returns:
        The value, null if not found.
      • getShortestMatch

        public V getShortestMatch​(String input)
        Description copied from interface: PrefixMap

        Return the value of the shortest matching prefix.

        The value returned is the shortest stored prefix for which is true: input.startsWith(prefix).

        Note that implementations may be constructed to match either case sensitive or case insensitive.

        Specified by:
        getShortestMatch in interface PrefixMap<V extends Serializable>
        Parameters:
        input - The string for which we need value of the stored prefix
        Returns:
        The value, null if not found.
      • getLongestMatch

        public V getLongestMatch​(String input)
        Description copied from interface: PrefixMap

        Return the value of the longest matching prefix.

        The value returned is the longest stored prefix for which is true: input.startsWith(prefix).

        Note that implementations may be constructed to match either case sensitive or case insensitive.

        Specified by:
        getLongestMatch in interface PrefixMap<V extends Serializable>
        Parameters:
        input - The string for which we need value of the stored prefix
        Returns:
        The value, null if not found.