# 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 83

#### close()

Close and release the map

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

#### get(key) → {Object}

Get a value from the map

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | Object | the key

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

##### Returns:

the value, or null if none

Type
  Object

#### isEmpty() → {boolean}

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

##### 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 56

##### 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 126

##### 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 70

##### 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

##### Parameters:

Name | Type | Description
--- | --- | ---
`key` | Object | the key
`value` | Object | the value

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

##### 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 172

##### 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

##### 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 157

##### Returns:

true if removed

Type
  boolean

#### size() → {number}

Get the size of the map

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

##### Returns:

the number of entries in the map

Type
  number