Top Description Methods
io.vertx.core

public Interface MultiMap

extends Iterable<Map.Entry<String, String>>
Known Direct Implementers
io.vertx.core.http.impl.headers.HeadersAdaptor, io.vertx.core.http.impl.headers.HeadersMultiMap, io.vertx.core.http.impl.headers.Http2HeadersAdaptor
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Fluent, .GenIgnore, .Nullable, .VertxGen, io.vertx.core.http.impl.headers.HeadersMultiMap, java.util.ArrayList, .List, .Map, .Set, java.util.function.BiConsumer, .Consumer, .Predicate

This class represents a MultiMap of String keys to a List of String values.

It's useful in Vert.x to represent things in Vert.x like HTTP headers and HTTP parameters which allow multiple values for keys.

Authors
Norman Maurer, Tim Fox

Method Summary

Modifier and TypeMethod and Description
public MultiMap

Returns:

a reference to this, so the API can be used fluently
add
(String
The name
name
,
String
The value being added
value
)

Adds a new value with the specified name and value.

public MultiMap
add(CharSequence name, CharSequence value)

Like add(String, String) but accepting CharSequence as parameters

public MultiMap

Returns:

a reference to this, so the API can be used fluently
add
(String
The name being set
name
,
Iterable<String>
The values
values
)

Adds a new values under the specified name

public MultiMap
add(CharSequence name, Iterable<CharSequence> values)

Like add(String, Iterable) but accepting CharSequence as parameters

public MultiMap

Returns:

a reference to this, so the API can be used fluently
addAll
(MultiMap map)

Adds all the entries from another MultiMap to this one

public MultiMap

Returns:

a reference to this, so the API can be used fluently
addAll
(Map<String, String> headers)

Adds all the entries from a Map to this

public static MultiMap

Returns:

the multi-map
caseInsensitiveMultiMap
()

Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.

public MultiMap

Returns:

a reference to this, so the API can be used fluently
clear
()

Removes all

public boolean

Returns:

true if at least one entry is found
contains
(String
The name to search for
name
)

Checks to see if there is a value with the specified name

public boolean
contains(CharSequence name)

Like contains(String) but accepting a CharSequence as a parameter

public default boolean

Returns:

true if at least one entry is found
contains
(String
the name to search for
name
,
String
the value to search for
value
,
boolean caseInsensitive)

Check if there is a header with the specified name and value.

public default boolean
contains(CharSequence name, CharSequence value, boolean caseInsensitive)

Like contains(String, String, boolean) but accepting CharSequence parameters.

public default List<Map.Entry<String, String>>

Returns:

A immutable java.util.List of the name-value entries, which will be empty if no pairs are found
entries
()

Returns all entries in the multi-map.

public default void
forEach(BiConsumer<String, String> action)

Allows iterating over the entries in the map

public String
public @Nullable String

Returns:

The first header value or null if there is no such entry
get
(String
The name of the header to search
name
)

Returns the value of with the specified name.

public List<String>

Returns:

A immutable java.util.List of values which will be empty if no values are found
getAll
(String
The name to search
name
)

Returns the values with the specified name

public List<String>
getAll(CharSequence name)

Like getAll(String) but accepting a CharSequence as a parameter

public boolean
isEmpty()

Return true if empty

public Set<String>

Returns:

A java.util.Set of all names
names
()

Gets a immutable java.util.Set of all names

public MultiMap

Returns:

a reference to this, so the API can be used fluently
remove
(String
The name of the value to remove
name
)

Removes the value with the given name

public MultiMap
remove(CharSequence name)

Like remove(String) but accepting CharSequence as parameters

public MultiMap

Returns:

a reference to this, so the API can be used fluently
set
(String
The name
name
,
String
The value
value
)

Sets a value under the specified name.

public MultiMap
set(CharSequence name, CharSequence value)

Like set(String, String) but accepting CharSequence as parameters

public MultiMap

Returns:

a reference to this, so the API can be used fluently
set
(String
The name of the headers being set
name
,
Iterable<String>
The values of the headers being set
values
)

Sets values for the specified name.

public MultiMap
set(CharSequence name, Iterable<CharSequence> values)

Like set(String, Iterable) but accepting CharSequence as parameters

public MultiMap

Returns:

a reference to this, so the API can be used fluently
setAll
(MultiMap map)

Cleans this instance.

public MultiMap

Returns:

a reference to this, so the API can be used fluently
setAll
(Map<String, String> headers)

Cleans and set all values of the given instance

public int
size()

Return the number of keys.

Inherited from java.lang.Iterable:
forEachiteratorspliterator

Method Detail

addback to summary
public MultiMap add(String name, String value)

Adds a new value with the specified name and value.

Parameters
name:String

The name

value:String

The value being added

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@Fluent
addback to summary
public MultiMap add(CharSequence name, CharSequence value)

Like add(String, String) but accepting CharSequence as parameters

Annotations
@GenIgnore:permitted-type
@Fluent
addback to summary
public MultiMap add(String name, Iterable<String> values)

Adds a new values under the specified name

Parameters
name:String

The name being set

values:Iterable<String>

The values

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@GenIgnore:permitted-type
@Fluent
addback to summary
public MultiMap add(CharSequence name, Iterable<CharSequence> values)

Like add(String, Iterable) but accepting CharSequence as parameters

Annotations
@GenIgnore:permitted-type
@Fluent
addAllback to summary
public MultiMap addAll(MultiMap map)

Adds all the entries from another MultiMap to this one

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@Fluent
addAllback to summary
public MultiMap addAll(Map<String, String> headers)

Adds all the entries from a Map to this

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@GenIgnore:permitted-type
@Fluent
caseInsensitiveMultiMapback to summary
public static MultiMap caseInsensitiveMultiMap()

Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.

Returns:MultiMap

the multi-map

clearback to summary
public MultiMap clear()

Removes all

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@Fluent
containsback to summary
public boolean contains(String name)

Checks to see if there is a value with the specified name

Parameters
name:String

The name to search for

Returns:boolean

true if at least one entry is found

containsback to summary
public boolean contains(CharSequence name)

Like contains(String) but accepting a CharSequence as a parameter

Annotations
@GenIgnore:permitted-type
containsback to summary
public 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:String

the name to search for

value:String

the value to search for

Returns:boolean

true if at least one entry is found

containsback to summary
public default boolean contains(CharSequence name, CharSequence value, boolean caseInsensitive)

Like contains(String, String, boolean) but accepting CharSequence parameters.

Annotations
@GenIgnore:permitted-type
entriesback to summary
public default List<Map.Entry<String, String>> entries()

Returns all entries in the multi-map.

Returns:List<Map.Entry<String, String>>

A immutable java.util.List of the name-value entries, which will be empty if no pairs are found

Annotations
@GenIgnore:permitted-type
forEachback to summary
public default void forEach(BiConsumer<String, String> action)

Allows iterating over the entries in the map

Annotations
@GenIgnore:permitted-type
getback to summary
public String get(CharSequence name)
Annotations
@GenIgnore:permitted-type
getback to summary
public @Nullable 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:String

The name of the header to search

Returns:@Nullable String

The first header value or null if there is no such entry

getAllback to summary
public List<String> getAll(String name)

Returns the values with the specified name

Parameters
name:String

The name to search

Returns:List<String>

A immutable java.util.List of values which will be empty if no values are found

getAllback to summary
public List<String> getAll(CharSequence name)

Like getAll(String) but accepting a CharSequence as a parameter

Annotations
@GenIgnore:permitted-type
isEmptyback to summary
public boolean isEmpty()

Return true if empty

namesback to summary
public Set<String> names()

Gets a immutable java.util.Set of all names

Returns:Set<String>

A java.util.Set of all names

removeback to summary
public MultiMap remove(String name)

Removes the value with the given name

Parameters
name:String

The name of the value to remove

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@Fluent
removeback to summary
public MultiMap remove(CharSequence name)

Like remove(String) but accepting CharSequence as parameters

Annotations
@GenIgnore:permitted-type
@Fluent
setback to summary
public 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:String

The name

value:String

The value

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@Fluent
setback to summary
public MultiMap set(CharSequence name, CharSequence value)

Like set(String, String) but accepting CharSequence as parameters

Annotations
@GenIgnore:permitted-type
@Fluent
setback to summary
public MultiMap set(String name, Iterable<String> values)

Sets values for the specified name.

Parameters
name:String

The name of the headers being set

values:Iterable<String>

The values of the headers being set

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@GenIgnore:permitted-type
@Fluent
setback to summary
public MultiMap set(CharSequence name, Iterable<CharSequence> values)

Like set(String, Iterable) but accepting CharSequence as parameters

Annotations
@GenIgnore:permitted-type
@Fluent
setAllback to summary
public MultiMap setAll(MultiMap map)

Cleans this instance.

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@Fluent
setAllback to summary
public MultiMap setAll(Map<String, String> headers)

Cleans and set all values of the given instance

Returns:MultiMap

a reference to this, so the API can be used fluently

Annotations
@GenIgnore:permitted-type
@Fluent
sizeback to summary
public int size()

Return the number of keys.