LocalMap

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

By default the map allows immutable keys and values. Custom keys and values should implement \io\vertx\jphp\core\shareddata\io.vertx.core.shareddata.Shareable interface. The map returns their copies.

This ensures there is no shared access to mutable state from different threads (e.g. different event loops) in the Vert.x instance, and means you don't have to protect access to that state using synchronization or locks.

Since the version 3.4, this class extends the interface. However some methods are only accessible in Java.

package

Default

Methods

__construct

__construct() 

Clear all entries in the map

clear() : void

Close and release the map

close() : void

Returns <code>true</code> if this map contains a mapping for the specified key.

containsKey( $arg0) : boolean

Arguments

$arg0

mixed

Response

boolean

{@code true} if this map contains a mapping for the specified key

Returns @{code true} if this map maps one or more keys to the specified value.

containsValue( $arg0) : boolean

Arguments

$arg0

mixed

Response

boolean

@{code true} if this map maps one or more keys to the specified value

Get a value from the map

get( $arg0) : mixed

Arguments

$arg0

mixed

Response

mixed

the value, or null if none

Returns the value to which the specified key is mapped, or <code>defaultValue</code> if this map contains no mapping for the key.

getOrDefault( $arg0,  $arg1) : mixed

Arguments

$arg0

mixed

$arg1

mixed

Response

mixed

the value to which the specified key is mapped, or {@code defaultValue} if this map contains no mapping for the key

isEmpty

isEmpty() : boolean

Response

boolean

true if there are zero entries in the map

Put an entry in the map

put( $arg0,  $arg1) : mixed

Arguments

$arg0

mixed

$arg1

mixed

Response

mixed

return the old value, or null if none

Put the entry only if there is no existing entry for that key

putIfAbsent( $arg0,  $arg1) : mixed

Arguments

$arg0

mixed

$arg1

mixed

Response

mixed

the old value or null, if none

Remove an entry from the map

remove( $arg0) : mixed

Arguments

$arg0

mixed

Response

mixed

the old value

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

removeIfPresent( $arg0,  $arg1) : boolean

This method is the poyglot version of @see \io\vertx\jphp\core\shareddata\LocalMap::remove.

Arguments

$arg0

mixed

$arg1

mixed

Response

boolean

true if removed

Replace the entry only if there is an existing entry with the key

replace( $arg0,  $arg1) : mixed

Arguments

$arg0

mixed

$arg1

mixed

Response

mixed

the old value

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

replaceIfPresent( $arg0,  $arg1,  $arg2) : boolean

This method is the polyglot version of @see \io\vertx\jphp\core\shareddata\LocalMap::replace.

Arguments

$arg0

mixed

$arg1

mixed

$arg2

mixed

Response

boolean

true if removed

Get the size of the map

size() : integer

Response

integer

the number of entries in the map