# 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:
  - vertx-js/local_map.js, line 29

### Methods

#### clear()

Clear all entries in the map

Source:
  - vertx-js/local_map.js, line 85

#### close()

Close and release the map

Source:
  - vertx-js/local_map.js, line 190

#### 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:
  - vertx-js/local_map.js, line 205

##### 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:
  - vertx-js/local_map.js, line 220

##### 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:
  - vertx-js/local_map.js, line 43

##### 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:
  - vertx-js/local_map.js, line 236

##### 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:
  - vertx-js/local_map.js, line 112

##### 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:
  - vertx-js/local_map.js, line 58

##### 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:
  - vertx-js/local_map.js, line 127

##### 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:
  - vertx-js/local_map.js, line 72

##### 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:
  - vertx-js/local_map.js, line 144

##### 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:
  - vertx-js/local_map.js, line 177

##### 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:
  - vertx-js/local_map.js, line 162

##### Returns:

true if removed

Type
  boolean

#### size() → {number}

Get the size of the map

Source:
  - vertx-js/local_map.js, line 99

##### Returns:

the number of entries in the map

Type
  number