Class MultiMap

    • Constructor Detail

      • MultiMap

        public MultiMap()
        Construct using a empty map.
      • MultiMap

        public MultiMap​(Map<String,​String[]> values)
        Construct using a string array map.
        Parameters:
        values -
    • Method Detail

      • setAll

        public void setAll​(Map<String,​String[]> values)
        Sets supplied values.
        Parameters:
        values -
      • setMore

        public String[] setMore​(String key,
                                String... values)
        Adds the supplied values to any values currently set under this key. A null value will be returned if no such value exists.
        Parameters:
        key - key
        values - values
        Returns:
        old value
      • set

        public String[] set​(String key,
                            String... values)
        Set a value. A null value will be returned if no such value exists.
        Parameters:
        key - key
        values - values
        Returns:
        old value
      • set

        public String[] set​(String key,
                            Collection<String> values)
        Set a value. A null value will be returned if no such value exists.
        Parameters:
        key - key
        values - values
        Returns:
        old value
      • getString

        public final String getString​(String key)
        Get the string value of an entry given its key. An empty string will be returned if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        string entry value
      • getStringOrDefault

        public final String getStringOrDefault​(String key,
                                               String defaultValue)
        Get the string value of an entry given its key or a default value if no such entry exists..
        Parameters:
        key - entry key
        defaultValue - default value
        Returns:
        string entry value
      • getStringOrNull

        public final String getStringOrNull​(String key)
        Get the string value of an entry given its key or null if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        string entry value
      • getStringOrFail

        public final String getStringOrFail​(String key)
        Get the string value of an entry given its key or fail with an exception if it does not.
        Parameters:
        key - key
        Returns:
        string value
        Throws:
        MultiMapException - if no such entry exists
      • getStringArray

        public final String[] getStringArray​(String key)
        Get the string array value of an entry given its key. An empty array will be returned if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        string array entry values
      • getStringArrayOrDefault

        public final String[] getStringArrayOrDefault​(String key,
                                                      String... defaultValues)
        Get the string array value of an entry given its key or default values if no such entry exists.
        Parameters:
        key - entry key
        defaultValues - default values
        Returns:
        string array entry values
      • getStringArrayOrNull

        public final String[] getStringArrayOrNull​(String key)
        Get the string array value of an entry given its key or null if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        string array entry value
      • getStringArrayOrFail

        public final String[] getStringArrayOrFail​(String key)
        Get the string array value of an entry given its key or fail with an exception if it does not.
        Parameters:
        key - entry key
        Returns:
        string array entry value
        Throws:
        MultiMapException - if no such entry exists
      • getBoolean

        public final Boolean getBoolean​(String key)
        Get the boolean value of an entry given its key. Boolean.FALSE will be returned if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        boolean entry value
      • getBooleanOrDefault

        public final Boolean getBooleanOrDefault​(String key,
                                                 boolean defaultValue)
        Get the boolean value of an entry given its key or a default value if no such entry exists.
        Parameters:
        key - entry key
        defaultValue - default value
        Returns:
        boolean entry value
      • getBooleanOrNull

        public final Boolean getBooleanOrNull​(String key)
        Get the boolean value of an entry given its key or null if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        boolean entry value
      • getBooleanOrFail

        public final Boolean getBooleanOrFail​(String key)
        Get the boolean value of an entry given its key or fail with an exception if it does not.
        Parameters:
        key - key
        Returns:
        boolean entry value
        Throws:
        MultiMapException - if no such entry exists
      • getInteger

        public final Integer getInteger​(String key)
        Get the integer value of an entry given its key. -1 will be returned if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        integer entry value
      • getIntegerOrDefault

        public final Integer getIntegerOrDefault​(String key,
                                                 Integer defaultValue)
        Get the integer value of an entry given its key or a default value if no such entry exists..
        Parameters:
        key - entry key
        defaultValue - default value
        Returns:
        integer entry value
      • getIntegerOrNull

        public final Integer getIntegerOrNull​(String key)
        Get the integer value of an entry given its key or null if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        integer entry value
      • getIntegerOrFail

        public final Integer getIntegerOrFail​(String key)
        Get the boolean value of an entry given its key or fail with an exception if it does not.
        Parameters:
        key - key
        Returns:
        boolean entry value
        Throws:
        MultiMapException - if no such entry exists
      • getMap

        public final Map<String,​String> getMap​(String key)
        Get the java.util.Map value of an entry given its key. Collections.emptyMap() will be returned if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        Map entry value
      • getMapOrDefault

        public final Map<String,​String> getMapOrDefault​(String key,
                                                              Map<String,​String> defaultValue)
        Get the java.util.Map value of an entry given its key or a default value if no such entry exists.
        Parameters:
        key - entry key
        defaultValue - default value
        Returns:
        Map entry value
      • getMapOrNull

        public final Map<String,​String> getMapOrNull​(String key)
        Get the java.util.Map value of an entry given its key or null if no such entry exists.
        Parameters:
        key - entry key
        Returns:
        Map entry value
      • getMapOrFail

        public final Map<String,​String> getMapOrFail​(String key)
        Get the java.util.Map value of an entry given its key or fail with an exception if it does not.
        Parameters:
        key - key
        Returns:
        Map entry value
        Throws:
        MultiMapException - if no such entry exists
      • getKeyIterator

        public final Iterable<String> getKeyIterator()
        Get an iterator of all keys.
        Returns:
        key iterator
      • toMultiMap

        public static MultiMap toMultiMap​(Properties originalMap)
        Create a new MultiMap given properties.
        Parameters:
        originalMap - string array map
        Returns:
        map
      • toMultiMap

        public static MultiMap toMultiMap​(Map<String,​String> originalMap)
        Create a new MultiMap given a string array map.
        Parameters:
        originalMap - string array map
        Returns:
        map
      • merge

        public void merge​(MultiMap source)