Package io.vertx.core

Interface MultiMap

    • Method Detail

      • caseInsensitiveMultiMap

        static MultiMap caseInsensitiveMultiMap()
        Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.
        Returns:
        the multi-map
      • get

        String get​(String name)
        Returns the value of with the specified name. If there are more than one values for the specified name, the first value is returned.
        Parameters:
        name - The name of the header to search
        Returns:
        The first header value or null if there is no such entry
      • getAll

        List<String> getAll​(String name)
        Returns the values with the specified name
        Parameters:
        name - The name to search
        Returns:
        A immutable List of values which will be empty if no values are found
      • forEach

        default void forEach​(java.util.function.BiConsumer<String,​String> action)
        Allows iterating over the entries in the map
      • entries

        default List<Map.Entry<String,​String>> entries()
        Returns all entries in the multi-map.
        Returns:
        A immutable List of the name-value entries, which will be empty if no pairs are found
      • contains

        boolean contains​(String name)
        Checks to see if there is a value with the specified name
        Parameters:
        name - The name to search for
        Returns:
        true if at least one entry is found
      • contains

        default boolean contains​(String name,
                                 String value,
                                 boolean caseInsensitive)
        Check if there is a header with the specified name and value. If caseInsensitive is true, value is compared in a case-insensitive way.
        Parameters:
        name - the name to search for
        value - the value to search for
        Returns:
        true if at least one entry is found
      • isEmpty

        boolean isEmpty()
        Return true if empty
      • names

        Set<String> names()
        Gets a immutable Set of all names
        Returns:
        A Set of all names
      • add

        MultiMap add​(String name,
                     String value)
        Adds a new value with the specified name and value.
        Parameters:
        name - The name
        value - The value being added
        Returns:
        a reference to this, so the API can be used fluently
      • add

        MultiMap add​(String name,
                     Iterable<String> values)
        Adds a new values under the specified name
        Parameters:
        name - The name being set
        values - The values
        Returns:
        a reference to this, so the API can be used fluently
      • addAll

        MultiMap addAll​(MultiMap map)
        Adds all the entries from another MultiMap to this one
        Returns:
        a reference to this, so the API can be used fluently
      • addAll

        MultiMap addAll​(Map<String,​String> headers)
        Adds all the entries from a Map to this
        Returns:
        a reference to this, so the API can be used fluently
      • set

        MultiMap set​(String name,
                     String value)
        Sets a value under the specified name.

        If there is an existing header with the same name, it is removed. Setting a null value removes the entry.

        Parameters:
        name - The name
        value - The value
        Returns:
        a reference to this, so the API can be used fluently
      • set

        MultiMap set​(String name,
                     Iterable<String> values)
        Sets values for the specified name.
        Parameters:
        name - The name of the headers being set
        values - The values of the headers being set
        Returns:
        a reference to this, so the API can be used fluently
      • setAll

        MultiMap setAll​(MultiMap map)
        Cleans this instance.
        Returns:
        a reference to this, so the API can be used fluently
      • setAll

        MultiMap setAll​(Map<String,​String> headers)
        Cleans and set all values of the given instance
        Returns:
        a reference to this, so the API can be used fluently
      • remove

        MultiMap remove​(String name)
        Removes the value with the given name
        Parameters:
        name - The name of the value to remove
        Returns:
        a reference to this, so the API can be used fluently
      • clear

        MultiMap clear()
        Removes all
        Returns:
        a reference to this, so the API can be used fluently
      • size

        int size()
        Return the number of keys.