# MutableObjectLongMap

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/ObjectLongMap.kt+class:androidx.collection.MutableObjectLongMap) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

*** ** * ** ***


```
public final class MutableObjectLongMap<K extends Object> extends ObjectLongMap<@NonNull K>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.collection.ObjectLongMap](https://developer.android.com/reference/androidx/collection/ObjectLongMap)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) K\> ||
|   | ↳ | [androidx.collection.MutableObjectLongMap](https://developer.android.com/reference/androidx/collection/MutableObjectLongMap) |

*** ** * ** ***

`https://developer.android.com/reference/androidx/collection/MutableObjectLongMap` is a container with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html`-like interface for keys with reference types and `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` primitives for values.

The underlying implementation is designed to avoid allocations from boxing, and insertion, removal, retrieval, and iteration operations. Allocations may still happen on insertion when the underlying storage needs to grow to accommodate newly added entries to the table. In addition, this implementation minimizes memory usage by avoiding the use of separate objects to hold key/value pairs.

This implementation is not thread-safe: if multiple threads access this container concurrently, and one or more threads modify the structure of the map (insertion or removal for instance), the calling code must provide the appropriate synchronization. Multiple threads are safe to read from this map concurrently if no write is happening.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableScatterMap` |   |

## Summary

| ### Public constructors |
|---|
| `<K extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#MutableObjectLongMap(kotlin.Int)(int initialCapacity)` Creates a new `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap` |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#clear()()` Removes all mappings from this map. |
| `final long` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#getOrPut(kotlin.Any,kotlin.Function0)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html> defaultValue)` Returns the value to which the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#getOrPut(kotlin.Any,kotlin.Function0)` is mapped, if the value is present in the map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull K key)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.Any)` and its associated value from the map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.Array)(@https://developer.android.com/reference/androidx/annotation/NonNull K[] keys)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.Array)` and their associated value from the map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.collections.Iterable)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Iterable.html<@https://developer.android.com/reference/androidx/annotation/NonNull K> keys)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.collections.Iterable)` and their associated value from the map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(androidx.collection.ScatterSet)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/ScatterSet<@https://developer.android.com/reference/androidx/annotation/NonNull K> keys)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(androidx.collection.ScatterSet)` and their associated value from the map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.sequences.Sequence)(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull K> keys)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.sequences.Sequence)` and their associated value from the map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#plusAssign(androidx.collection.ObjectLongMap)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/ObjectLongMap<@https://developer.android.com/reference/androidx/annotation/NonNull K> from)` Puts all the key/value mappings in the `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#plusAssign(androidx.collection.ObjectLongMap)` map into this map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, long value)` Creates a new mapping from `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)` in this map. |
| `final long` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, long value, long default)` Creates a new mapping from `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` in this map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#putAll(androidx.collection.ObjectLongMap)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/ObjectLongMap<@https://developer.android.com/reference/androidx/annotation/NonNull K> from)` Puts all the key/value mappings in the `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#putAll(androidx.collection.ObjectLongMap)` map into this map. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull K key)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any)` and its associated value from the map. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, long value)` Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any,kotlin.Long)` and its associated value from the map if the associated value equals `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any,kotlin.Long)`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#removeIf(kotlin.Function2)( @https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull K, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate )` Removes any mapping for which the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#removeIf(kotlin.Function2)` returns true. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, long value)` Creates a new mapping from `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)` in this map. |
| `final int` | `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#trim()()` Trims this `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap`'s storage so it is sized appropriately to hold the current mappings. |

### Inherited methods

From [androidx.collection.ObjectLongMap](https://developer.android.com/reference/androidx/collection/ObjectLongMap) `final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#all(kotlin.Function2)(@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull K, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns true if all entries match the given `https://developer.android.com/reference/androidx/collection/ObjectLongMap#all(kotlin.Function2)`.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#any()()`

Returns `true` if this map has at least one entry.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#any(kotlin.Function2)(@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull K, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns true if at least one entry matches the given `https://developer.android.com/reference/androidx/collection/ObjectLongMap#any(kotlin.Function2)`.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#contains(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull K key)`

Returns true if the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#contains(kotlin.Any)` is present in this map, false otherwise.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#containsKey(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull K key)`

Returns true if the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#containsKey(kotlin.Any)` is present in this map, false otherwise.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#containsValue(kotlin.Long)(long value)`

Returns true if the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#containsValue(kotlin.Long)` is present in this map, false otherwise.
`final int` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#count()()`

Returns the number of entries in this map.
`final int` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#count(kotlin.Function2)(
@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull K, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate
)`

Returns the number of entries matching the given `https://developer.android.com/reference/androidx/collection/ObjectLongMap#count(kotlin.Function2)`.
`boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)`

Compares the specified object `https://developer.android.com/reference/androidx/collection/ObjectLongMap#equals(kotlin.Any)` with this hash map for equality.
`final void` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#forEach(kotlin.Function2)(@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull key, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block)`

Iterates over every key/value pair stored in this map by invoking the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#forEach(kotlin.Function2)` lambda.
`final void` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#forEachKey(kotlin.Function1)(@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull key, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block)`

Iterates over every key stored in this map by invoking the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#forEachKey(kotlin.Function1)` lambda.
`final void` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#forEachValue(kotlin.Function1)(@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block)`

Iterates over every value stored in this map by invoking the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#forEachValue(kotlin.Function1)` lambda.
`final long` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#get(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull K key)`

Returns the value corresponding to the given `https://developer.android.com/reference/androidx/collection/ObjectLongMap#get(kotlin.Any)`, or throws if the key is not present in the map.
`final int` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getCapacity()()`

Returns the number of key-value pairs that can be stored in this map without requiring internal storage reallocation.
`final long` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getOrDefault(kotlin.Any,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, long defaultValue)`

Returns the value to which the specified `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getOrDefault(kotlin.Any,kotlin.Long)` is mapped, or `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getOrDefault(kotlin.Any,kotlin.Long)` if this map contains no mapping for the key.
`final long` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getOrElse(kotlin.Any,kotlin.Function0)(@https://developer.android.com/reference/androidx/annotation/NonNull K key, @https://developer.android.com/reference/androidx/annotation/NonNull Function0<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html> defaultValue)`

Returns the value for the given `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getOrElse(kotlin.Any,kotlin.Function0)` if the value is present.
`final int` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#getSize()()`

Returns the number of key-value pairs in this map.
`int` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#hashCode()()`

Returns the hash code value for this map.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#isEmpty()()`

Indicates whether this map is empty.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#isNotEmpty()()`

Returns `true` if this map is not empty.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html separator,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html prefix,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html postfix,
int limit,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html truncated
)`

Creates a String from the entries, separated by `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` and using `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` before and `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` after, if supplied.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html separator,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html prefix,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html postfix,
int limit,
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html truncated,
@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull key, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/CharSequence.html> transform
)`

Creates a String from the entries, separated by `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` and using `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` before and `https://developer.android.com/reference/androidx/collection/ObjectLongMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` after, if supplied.
`final boolean` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#none()()`

Returns `true` if this map has no entries.
`@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/collection/ObjectLongMap#toString()()`

Returns a string representation of this map.

## Public constructors

### MutableObjectLongMap

```
public <K extends Object> MutableObjectLongMap(int initialCapacity)
```

Creates a new `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap`

| Parameters |
|---|---|
| `int initialCapacity` | The initial desired capacity for this container. the container will honor this value by guaranteeing its internal structures can hold that many entries without requiring any allocations. The initial capacity can be set to 0. |

## Public methods

### clear

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void clear()
```

Removes all mappings from this map.

### getOrPut

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final long getOrPut(@NonNull K key, @NonNull Function0<@NonNull Long> defaultValue)
```

Returns the value to which the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#getOrPut(kotlin.Any,kotlin.Function0)` is mapped, if the value is present in the map. Otherwise, calls `defaultValue()` and puts the result in the map associated with `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#getOrPut(kotlin.Any,kotlin.Function0)`.

### minusAssign

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void minusAssign(@NonNull K key)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.Any)` and its associated value from the map.

### minusAssign

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void minusAssign(@NonNull K[] keys)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.Array)` and their associated value from the map.

### minusAssign

```
public final void minusAssign(@NonNull Iterable<@NonNull K> keys)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.collections.Iterable)` and their associated value from the map.

### minusAssign

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void minusAssign(@NonNull ScatterSet<@NonNull K> keys)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(androidx.collection.ScatterSet)` and their associated value from the map.

### minusAssign

```
public final void minusAssign(@NonNull Sequence<@NonNull K> keys)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#minusAssign(kotlin.sequences.Sequence)` and their associated value from the map.

### plusAssign

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void plusAssign(@NonNull ObjectLongMap<@NonNull K> from)
```

Puts all the key/value mappings in the `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#plusAssign(androidx.collection.ObjectLongMap)` map into this map.

### put

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void put(@NonNull K key, long value)
```

Creates a new mapping from `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)` in this map. If `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)` is already present in the map, the association is modified and the previously associated value is replaced with `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)`. If `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long)` is not present, a new entry is added to the map, which may require to grow the underlying storage and cause allocations.

### put

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final long put(@NonNull K key, long value, long default)
```

Creates a new mapping from `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` in this map. If `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` is already present in the map, the association is modified and the previously associated value is replaced with `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)`. If `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` is not present, a new entry is added to the map, which may require to grow the underlying storage and cause allocations.

| Returns |
|---|---|
| `long` | value previously associated with `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` or `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#put(kotlin.Any,kotlin.Long,kotlin.Long)` if key was not present. |

### putAll

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void putAll(@NonNull ObjectLongMap<@NonNull K> from)
```

Puts all the key/value mappings in the `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#putAll(androidx.collection.ObjectLongMap)` map into this map.

### remove

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void remove(@NonNull K key)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any)` and its associated value from the map.

### remove

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final boolean remove(@NonNull K key, long value)
```

Removes the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any,kotlin.Long)` and its associated value from the map if the associated value equals `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#remove(kotlin.Any,kotlin.Long)`. Returns whether the removal happened.

### removeIf

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void removeIf(
    @NonNull Function2<@NonNull K, @NonNull Long, @NonNull Boolean> predicate
)
```

Removes any mapping for which the specified `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#removeIf(kotlin.Function2)` returns true.

### set

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final void set(@NonNull K key, long value)
```

Creates a new mapping from `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)` in this map. If `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)` is already present in the map, the association is modified and the previously associated value is replaced with `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)`. If `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap#set(kotlin.Any,kotlin.Long)` is not present, a new entry is added to the map, which may require to grow the underlying storage and cause allocations.

### trim

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/collection#1.4.0)

```
public final int trim()
```

Trims this `https://developer.android.com/reference/androidx/collection/MutableObjectLongMap`'s storage so it is sized appropriately to hold the current mappings.

Returns the number of empty entries removed from this map's storage. Returns be 0 if no trimming is necessary or possible.