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

The map only allows immutable keys and values in the map, OR certain mutable objects such as Buffer instances which will be copied when they are added to the map.

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.

no subtypes hierarchy

Initializer
LocalMap(LocalMap<out Object,out Object> unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
clearshared default void clear()

Clear all entries in the map

closeshared default void close()

Close and release the map

getshared default V? get(K? key)

Get a value from the map

Parameters:
  • key

    the key

isEmptyshared default Boolean isEmpty()

@return true if there are zero entries in the map

putshared default V? put(K? key, V? value)

Put an entry in the map

Parameters:
  • key

    the key

  • value

    the value

putIfAbsentshared default V? putIfAbsent(K? key, V? value)

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

Parameters:
  • key

    the key

  • value

    the value

removeshared default V? remove(K? key)

Remove an entry from the map

Parameters:
  • key

    the key

removeIfPresentshared default Boolean removeIfPresent(K? key, V? value)

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

Parameters:
  • key

    the key

  • value

    the value

replaceshared default V? replace(K? key, V? value)

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

Parameters:
  • key

    the key

  • value

    the new value

replaceIfPresentshared default Boolean replaceIfPresent(K? key, V? oldValue, V? newValue)

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

Parameters:
  • key

    the key

  • oldValue

    the old value

  • newValue

    the new value

sizeshared default Integer size()

Get the size of the map

Inherited Methods
Methods inherited from: Object
equals