Class: MultiMap

vertx-js/multi_map~ MultiMap

new MultiMap()

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.

Source:

Methods

add(name, value) → {MultiMap}

Adds a new value with the specified name and value.
Parameters:
Name Type Description
name string The name
value string The value being added
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MultiMap

addAll(map) → {MultiMap}

Adds all the entries from another MultiMap to this one
Parameters:
Name Type Description
map MultiMap
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MultiMap

clear() → {MultiMap}

Removes all
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MultiMap

contains(name) → {boolean}

Checks to see if there is a value with the specified name
Parameters:
Name Type Description
name string The name to search for
Source:
Returns:
true if at least one entry is found
Type
boolean

get(name) → {string}

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 Type Description
name string The name of the header to search
Source:
Returns:
The first header value or null if there is no such entry
Type
string

getAll(name) → {Array.<string>}

Returns the values with the specified name
Parameters:
Name Type Description
name string The name to search
Source:
Returns:
A immutable List of values which will be empty if no values are found
Type
Array.<string>

isEmpty() → {boolean}

Return true if empty
Source:
Returns:
Type
boolean

names() → {Array.<string>}

Gets a immutable Set of all names
Source:
Returns:
A Set of all names
Type
Array.<string>

remove(name) → {MultiMap}

Removes the value with the given name
Parameters:
Name Type Description
name string The name of the value to remove
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MultiMap

set(name, value) → {MultiMap}

Sets a value under the specified name.

If there is an existing header with the same name, it is removed.

Parameters:
Name Type Description
name string The name
value string The value
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MultiMap

setAll(map) → {MultiMap}

Cleans this instance.
Parameters:
Name Type Description
map MultiMap
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MultiMap

size() → {number}

Return the number of keys.
Source:
Returns:
Type
number