Class: LocalMap

vertx-js/local_map~ LocalMap

new LocalMap()

Local maps can be used to share data safely in a single Vert.x instance.

Source:

Methods

clear()

Clear all entries in the map
Source:

close()

Close and release the map
Source:

containsKey(key) → {boolean}

Returns true if this map contains a mapping for the specified key.
Parameters:
Name Type Description
key Object key whose presence in this map is to be tested
Source:
Returns:
true if this map contains a mapping for the specified key
Type
boolean

containsValue(value) → {boolean}

Returns @{code true} if this map maps one or more keys to the specified value.
Parameters:
Name Type Description
value Object value whose presence in this map is to be tested
Source:
Returns:
@{code true} if this map maps one or more keys to the specified value
Type
boolean

get(key) → {Object}

Get a value from the map
Parameters:
Name Type Description
key Object the key
Source:
Returns:
the value, or null if none
Type
Object

getOrDefault(key, defaultValue) → {Object}

Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.
Parameters:
Name Type Description
key Object the key whose associated value is to be returned
defaultValue Object the default mapping of the key
Source:
Returns:
the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key
Type
Object

isEmpty() → {boolean}

Source:
Returns:
true if there are zero entries in the map
Type
boolean

put(key, value) → {Object}

Put an entry in the map
Parameters:
Name Type Description
key Object the key
value Object the value
Source:
Returns:
return the old value, or null if none
Type
Object

putIfAbsent(key, value) → {Object}

Put the entry only if there is no existing entry for that key
Parameters:
Name Type Description
key Object the key
value Object the value
Source:
Returns:
the old value or null, if none
Type
Object

remove(key) → {Object}

Remove an entry from the map
Parameters:
Name Type Description
key Object the key
Source:
Returns:
the old value
Type
Object

removeIfPresent(key, value) → {boolean}

Remove the entry only if there is an entry with the specified key and value.

This method is the poyglot version of LocalMap#remove.

Parameters:
Name Type Description
key Object the key
value Object the value
Source:
Returns:
true if removed
Type
boolean

replace(key, value) → {Object}

Replace the entry only if there is an existing entry with the key
Parameters:
Name Type Description
key Object the key
value Object the new value
Source:
Returns:
the old value
Type
Object

replaceIfPresent(key, oldValue, newValue) → {boolean}

Replace the entry only if there is an existing entry with the specified key and value.

This method is the polyglot version of LocalMap#replace.

Parameters:
Name Type Description
key Object the key
oldValue Object the old value
newValue Object the new value
Source:
Returns:
true if removed
Type
boolean

size() → {number}

Get the size of the map
Source:
Returns:
the number of entries in the map
Type
number