# MutableLongList

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

*** ** * ** ***


```
public final class MutableLongList extends LongList
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.collection.LongList](https://developer.android.com/reference/androidx/collection/LongList) ||
|   | ↳ | [androidx.collection.MutableLongList](https://developer.android.com/reference/androidx/collection/MutableLongList) |

*** ** * ** ***

`https://developer.android.com/reference/androidx/collection/MutableLongList` is a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html`-like collection for `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` values. It allows storing and retrieving the elements without boxing. Immutable access is available through its base class `https://developer.android.com/reference/androidx/collection/LongList`, which has a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html`-like interface.

This implementation is not thread-safe: if multiple threads access this container concurrently, and one or more threads modify the structure of the list (insertion or removal for instance), the calling code must provide the appropriate synchronization. It is also not safe to mutate during reentrancy -- in the middle of a `https://developer.android.com/reference/androidx/collection/LongList#forEach(kotlin.Function1)`, for example. However, concurrent reads are safe.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/collection/MutableLongList#MutableLongList(kotlin.Int)(int initialCapacity)` Creates a `https://developer.android.com/reference/androidx/collection/MutableLongList` with a `https://developer.android.com/reference/androidx/collection/MutableLongList#capacity()` of `initialCapacity`. |

| ### Public methods |
|---|---|
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Long)(long element)` Adds `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Long)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index, long element)` Adds `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)` and after, if any. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.LongArray)(@https://developer.android.com/reference/androidx/annotation/NonNull long[] elements)` Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.LongArray)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.LongArray)` was empty. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)` Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(androidx.collection.LongList)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(androidx.collection.LongList)` was empty. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index, @https://developer.android.com/reference/androidx/annotation/NonNull long[] elements)` Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)` and after, if any. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)` Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)` and after, if any. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#clear()()` Removes all elements in the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#ensureCapacity(kotlin.Int)(int capacity)` Ensures that there is enough space to store `https://developer.android.com/reference/androidx/collection/MutableLongList#ensureCapacity(kotlin.Int)` elements in the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final int` | `https://developer.android.com/reference/androidx/collection/MutableLongList#getCapacity()()` Returns the total number of elements that can be held before the `https://developer.android.com/reference/androidx/collection/MutableLongList` must grow. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(kotlin.Long)(long element)` `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(kotlin.Long)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList` |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(kotlin.LongArray)(@https://developer.android.com/reference/androidx/annotation/NonNull long[] elements)` Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(kotlin.LongArray)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)` Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(androidx.collection.LongList)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(kotlin.Long)(long element)` `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(kotlin.Long)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(kotlin.LongArray)(@https://developer.android.com/reference/androidx/annotation/NonNull long[] elements)` Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(kotlin.LongArray)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)` Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(androidx.collection.LongList)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#remove(kotlin.Long)(long element)` Removes `https://developer.android.com/reference/androidx/collection/MutableLongList#remove(kotlin.Long)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAll(kotlin.LongArray)(@https://developer.android.com/reference/androidx/annotation/NonNull long[] elements)` Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAll(kotlin.LongArray)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if anything was removed. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAll(androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)` Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAll(androidx.collection.LongList)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if anything was removed. |
| `final long` | `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAt(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index)` Removes the element at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAt(kotlin.Int)` and returns it. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int start, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int end)` Removes items from index `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` (inclusive) to `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` (exclusive). |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#retainAll(kotlin.LongArray)(@https://developer.android.com/reference/androidx/annotation/NonNull long[] elements)` Keeps only `https://developer.android.com/reference/androidx/collection/MutableLongList#retainAll(kotlin.LongArray)` in the `https://developer.android.com/reference/androidx/collection/MutableLongList` and removes all other values. |
| `final boolean` | `https://developer.android.com/reference/androidx/collection/MutableLongList#retainAll(androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)` Keeps only `https://developer.android.com/reference/androidx/collection/MutableLongList#retainAll(androidx.collection.LongList)` in the `https://developer.android.com/reference/androidx/collection/MutableLongList` and removes all other values. |
| `final long` | `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index, long element)` Sets the value at `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)`. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#sort()()` Sorts the `https://developer.android.com/reference/androidx/collection/MutableLongList` elements in ascending order. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#sortDescending()()` Sorts the `https://developer.android.com/reference/androidx/collection/MutableLongList` elements in descending order. |
| `final void` | `https://developer.android.com/reference/androidx/collection/MutableLongList#trim(kotlin.Int)(int minCapacity)` Reduces the internal storage. |

### Inherited methods

From [androidx.collection.LongList](https://developer.android.com/reference/androidx/collection/LongList) `final boolean` `https://developer.android.com/reference/androidx/collection/LongList#any()()`

Returns `true` if there's at least one element in the collection.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#any(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns `true` if any of the elements give a `true` return value for `https://developer.android.com/reference/androidx/collection/LongList#any(kotlin.Function1)`.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)(
int element,
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int fromIndex,
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int toIndex
)`

Searches this list for the specified `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)` in the range defined by `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)` and `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)`.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Long,kotlin.Int,kotlin.Int)(
long element,
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int fromIndex,
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int toIndex
)`

Searches this list for the specified `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Long,kotlin.Int,kotlin.Int)` in the range defined by `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Long,kotlin.Int,kotlin.Int)` and `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Long,kotlin.Int,kotlin.Int)`.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Function1)(
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int fromIndex,
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int toIndex,
@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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> comparison
)`

Searches this `https://developer.android.com/reference/androidx/collection/LongList` or its range for an element for which the given `https://developer.android.com/reference/androidx/collection/LongList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Function1)` function returns zero using binary search algorithm.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#contains(kotlin.Long)(long element)`

Returns `true` if the `https://developer.android.com/reference/androidx/collection/LongList` contains `https://developer.android.com/reference/androidx/collection/LongList#contains(kotlin.Long)` or `false` otherwise.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#containsAll(androidx.collection.LongList)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/collection/LongList elements)`

Returns `true` if the `https://developer.android.com/reference/androidx/collection/LongList` contains all elements in `https://developer.android.com/reference/androidx/collection/LongList#containsAll(androidx.collection.LongList)` or `false` if one or more are missing.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#count()()`

Returns the number of elements in this list.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#count(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Counts the number of elements matching `https://developer.android.com/reference/androidx/collection/LongList#count(kotlin.Function1)`.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#elementAt(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index)`

Returns the element at the given `https://developer.android.com/reference/androidx/collection/LongList#elementAt(kotlin.Int)` or throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` if the `https://developer.android.com/reference/androidx/collection/LongList#elementAt(kotlin.Int)` is out of bounds of this collection.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#elementAtOrElse(kotlin.Int,kotlin.Function1)(
@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index,
@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Long.html> defaultValue
)`

Returns the element at the given `https://developer.android.com/reference/androidx/collection/LongList#elementAtOrElse(kotlin.Int,kotlin.Function1)` or `https://developer.android.com/reference/androidx/collection/LongList#elementAtOrElse(kotlin.Int,kotlin.Function1)` if `https://developer.android.com/reference/androidx/collection/LongList#elementAtOrElse(kotlin.Int,kotlin.Function1)` is out of bounds of the collection.
`boolean` `https://developer.android.com/reference/androidx/collection/LongList#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)`

Returns `true` if `https://developer.android.com/reference/androidx/collection/LongList#equals(kotlin.Any)` is a `https://developer.android.com/reference/androidx/collection/LongList` and the contents of this and `https://developer.android.com/reference/androidx/collection/LongList#equals(kotlin.Any)` are the same.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#first()()`

Returns the first element in the `https://developer.android.com/reference/androidx/collection/LongList` or throws a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if it `https://developer.android.com/reference/androidx/collection/LongList#isEmpty()`.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#first(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns the first element in the `https://developer.android.com/reference/androidx/collection/LongList` for which `https://developer.android.com/reference/androidx/collection/LongList#first(kotlin.Function1)` returns `true` or throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if nothing matches.
`final @https://developer.android.com/reference/androidx/annotation/NonNull R` `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/collection/LongList#fold(kotlin.Any,kotlin.Function2)(
@https://developer.android.com/reference/androidx/annotation/NonNull R initial,
@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull acc, @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 R> operation
)`

Accumulates values, starting with `https://developer.android.com/reference/androidx/collection/LongList#fold(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/androidx/collection/LongList#fold(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/androidx/collection/LongList` in order.
`final @https://developer.android.com/reference/androidx/annotation/NonNull R` `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/collection/LongList#foldIndexed(kotlin.Any,kotlin.Function3)(
@https://developer.android.com/reference/androidx/annotation/NonNull R initial,
@https://developer.android.com/reference/androidx/annotation/NonNull Function3<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull acc, @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 R> operation
)`

Accumulates values, starting with `https://developer.android.com/reference/androidx/collection/LongList#foldIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/androidx/collection/LongList#foldIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/androidx/collection/LongList` in order.
`final @https://developer.android.com/reference/androidx/annotation/NonNull R` `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/collection/LongList#foldRight(kotlin.Any,kotlin.Function2)(
@https://developer.android.com/reference/androidx/annotation/NonNull R initial,
@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@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 acc, @https://developer.android.com/reference/androidx/annotation/NonNull R> operation
)`

Accumulates values, starting with `https://developer.android.com/reference/androidx/collection/LongList#foldRight(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/androidx/collection/LongList#foldRight(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/androidx/collection/LongList` in reverse order.
`final @https://developer.android.com/reference/androidx/annotation/NonNull R` `<R extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/collection/LongList#foldRightIndexed(kotlin.Any,kotlin.Function3)(
@https://developer.android.com/reference/androidx/annotation/NonNull R initial,
@https://developer.android.com/reference/androidx/annotation/NonNull Function3<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @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 acc, @https://developer.android.com/reference/androidx/annotation/NonNull R> operation
)`

Accumulates values, starting with `https://developer.android.com/reference/androidx/collection/LongList#foldRightIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/androidx/collection/LongList#foldRightIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/androidx/collection/LongList` in reverse order.
`final void` `https://developer.android.com/reference/androidx/collection/LongList#forEach(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)`

Calls `https://developer.android.com/reference/androidx/collection/LongList#forEach(kotlin.Function1)` for each element in the `https://developer.android.com/reference/androidx/collection/LongList`, in order.
`final void` `https://developer.android.com/reference/androidx/collection/LongList#forEachIndexed(kotlin.Function2)(
@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @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
)`

Calls `https://developer.android.com/reference/androidx/collection/LongList#forEachIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/androidx/collection/LongList` along with its index, in order.
`final void` `https://developer.android.com/reference/androidx/collection/LongList#forEachReversed(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)`

Calls `https://developer.android.com/reference/androidx/collection/LongList#forEachReversed(kotlin.Function1)` for each element in the `https://developer.android.com/reference/androidx/collection/LongList` in reverse order.
`final void` `https://developer.android.com/reference/androidx/collection/LongList#forEachReversedIndexed(kotlin.Function2)(
@https://developer.android.com/reference/androidx/annotation/NonNull Function2<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @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
)`

Calls `https://developer.android.com/reference/androidx/collection/LongList#forEachReversedIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/androidx/collection/LongList` along with its index, in reverse order.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#get(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index)`

Returns the element at the given `https://developer.android.com/reference/androidx/collection/LongList#get(kotlin.Int)` or throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` if the `https://developer.android.com/reference/androidx/collection/LongList#get(kotlin.Int)` is out of bounds of this collection.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` `https://developer.android.com/reference/androidx/collection/LongList#getIndices()()`

Returns an `https://developer.android.com/reference/androidx/annotation/IntRange` of the valid indices for this `https://developer.android.com/reference/androidx/collection/LongList`.
`final @https://developer.android.com/reference/androidx/annotation/IntRange(from = -1) int` `https://developer.android.com/reference/androidx/collection/LongList#getLastIndex()()`

Returns the last valid index in the `https://developer.android.com/reference/androidx/collection/LongList`.
`final @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` `https://developer.android.com/reference/androidx/collection/LongList#getSize()()`

The number of elements in the `https://developer.android.com/reference/androidx/collection/LongList`.
`int` `https://developer.android.com/reference/androidx/collection/LongList#hashCode()()`

Returns a hash code based on the contents of the `https://developer.android.com/reference/androidx/collection/LongList`.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#indexOf(kotlin.Long)(long element)`

Returns the index of `https://developer.android.com/reference/androidx/collection/LongList#indexOf(kotlin.Long)` in the `https://developer.android.com/reference/androidx/collection/LongList` or `-1` if `https://developer.android.com/reference/androidx/collection/LongList#indexOf(kotlin.Long)` is not there.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#indexOfFirst(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns the index if the first element in the `https://developer.android.com/reference/androidx/collection/LongList` for which `https://developer.android.com/reference/androidx/collection/LongList#indexOfFirst(kotlin.Function1)` returns `true`.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#indexOfLast(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns the index if the last element in the `https://developer.android.com/reference/androidx/collection/LongList` for which `https://developer.android.com/reference/androidx/collection/LongList#indexOfLast(kotlin.Function1)` returns `true`.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#isEmpty()()`

Returns `true` if the `https://developer.android.com/reference/androidx/collection/LongList` has no elements in it or `false` otherwise.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#isNotEmpty()()`

Returns `true` if there are elements in the `https://developer.android.com/reference/androidx/collection/LongList` or `false` if it is 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/LongList#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 elements separated by `https://developer.android.com/reference/androidx/collection/LongList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` and using `https://developer.android.com/reference/androidx/collection/LongList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` before and `https://developer.android.com/reference/androidx/collection/LongList#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/LongList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)(
@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 Function1<@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 elements separated by `https://developer.android.com/reference/androidx/collection/LongList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` and using `https://developer.android.com/reference/androidx/collection/LongList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` before and `https://developer.android.com/reference/androidx/collection/LongList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` after, if supplied.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#last()()`

Returns the last element in the `https://developer.android.com/reference/androidx/collection/LongList` or throws a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if it `https://developer.android.com/reference/androidx/collection/LongList#isEmpty()`.
`final long` `https://developer.android.com/reference/androidx/collection/LongList#last(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns the last element in the `https://developer.android.com/reference/androidx/collection/LongList` for which `https://developer.android.com/reference/androidx/collection/LongList#last(kotlin.Function1)` returns `true` or throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if nothing matches.
`final int` `https://developer.android.com/reference/androidx/collection/LongList#lastIndexOf(kotlin.Long)(long element)`

Returns the index of the last element in the `https://developer.android.com/reference/androidx/collection/LongList` that is the same as `https://developer.android.com/reference/androidx/collection/LongList#lastIndexOf(kotlin.Long)` or `-1` if no elements match.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#none()()`

Returns `true` if the collection has no elements in it.
`final boolean` `https://developer.android.com/reference/androidx/collection/LongList#reversedAny(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://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Boolean.html> predicate)`

Returns `true` if any of the elements give a `true` return value for `https://developer.android.com/reference/androidx/collection/LongList#reversedAny(kotlin.Function1)` while iterating in the reverse order.
`@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/collection/LongList#toString()()`

Returns a String representation of the list, surrounded by "\[\]" and each element separated by ", ".

## Public constructors

### MutableLongList

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

```
public MutableLongList(int initialCapacity)
```

Creates a `https://developer.android.com/reference/androidx/collection/MutableLongList` with a `https://developer.android.com/reference/androidx/collection/MutableLongList#capacity()` of `initialCapacity`.

## Public methods

### add

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

```
public final boolean add(long element)
```

Adds `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Long)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true`.

### add

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

```
public final void add(@IntRange(from = 0) int index, long element)
```

Adds `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)` and after, if any.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#add(kotlin.Int,kotlin.Long)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/LongList#size()`, inclusive |

### addAll

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

```
public final boolean addAll(@NonNull long[] elements)
```

Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.LongArray)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.LongArray)` was empty.

### addAll

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

```
public final boolean addAll(@NonNull LongList elements)
```

Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(androidx.collection.LongList)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(androidx.collection.LongList)` was empty.

### addAll

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

```
public final boolean addAll(@IntRange(from = 0) int index, @NonNull long[] elements)
```

Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)` and after, if any.

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)` was empty |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,kotlin.LongArray)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/LongList#size()`, inclusive. |

### addAll

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

```
public final boolean addAll(@IntRange(from = 0) int index, @NonNull LongList elements)
```

Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList` at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)` and after, if any.

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)` was empty |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#addAll(kotlin.Int,androidx.collection.LongList)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/LongList#size()`, inclusive |

### clear

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

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

Removes all elements in the `https://developer.android.com/reference/androidx/collection/MutableLongList`. The storage isn't released.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableLongList#trim(kotlin.Int)` |   |

### ensureCapacity

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

```
public final void ensureCapacity(int capacity)
```

Ensures that there is enough space to store `https://developer.android.com/reference/androidx/collection/MutableLongList#ensureCapacity(kotlin.Int)` elements in the `https://developer.android.com/reference/androidx/collection/MutableLongList`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableLongList#trim(kotlin.Int)` |   |

### getCapacity

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

```
public final int getCapacity()
```

Returns the total number of elements that can be held before the `https://developer.android.com/reference/androidx/collection/MutableLongList` must grow.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableLongList#ensureCapacity(kotlin.Int)` |   |

### minusAssign

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

```
public final void minusAssign(long element)
```

`https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(kotlin.Long)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`

### minusAssign

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

```
public final void minusAssign(@NonNull long[] elements)
```

Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(kotlin.LongArray)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`.

### minusAssign

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

```
public final void minusAssign(@NonNull LongList elements)
```

Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#minusAssign(androidx.collection.LongList)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`.

### plusAssign

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

```
public final void plusAssign(long element)
```

`https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(kotlin.Long)` to the `https://developer.android.com/reference/androidx/collection/MutableLongList`.

### plusAssign

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

```
public final void plusAssign(@NonNull long[] elements)
```

Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(kotlin.LongArray)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList`.

### plusAssign

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

```
public final void plusAssign(@NonNull LongList elements)
```

Adds all `https://developer.android.com/reference/androidx/collection/MutableLongList#plusAssign(androidx.collection.LongList)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableLongList`.

### remove

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

```
public final boolean remove(long element)
```

Removes `https://developer.android.com/reference/androidx/collection/MutableLongList#remove(kotlin.Long)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList`. If `https://developer.android.com/reference/androidx/collection/MutableLongList#remove(kotlin.Long)` was in the `https://developer.android.com/reference/androidx/collection/MutableLongList` and was removed, `true` will be returned, or `false` will be returned if the element was not found.

### removeAll

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

```
public final boolean removeAll(@NonNull long[] elements)
```

Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAll(kotlin.LongArray)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if anything was removed.

### removeAll

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

```
public final boolean removeAll(@NonNull LongList elements)
```

Removes all `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAll(androidx.collection.LongList)` from the `https://developer.android.com/reference/androidx/collection/MutableLongList` and returns `true` if anything was removed.

### removeAt

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

```
public final long removeAt(@IntRange(from = 0) int index)
```

Removes the element at the given `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAt(kotlin.Int)` and returns it.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#removeAt(kotlin.Int)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/LongList#lastIndex()`, inclusive |

### removeRange

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

```
public final void removeRange(@IntRange(from = 0) int start, @IntRange(from = 0) int end)
```

Removes items from index `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` (inclusive) to `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` (exclusive).

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` or `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/LongList#size()`, inclusive |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` is greater than `https://developer.android.com/reference/androidx/collection/MutableLongList#removeRange(kotlin.Int,kotlin.Int)` |

### retainAll

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

```
public final boolean retainAll(@NonNull long[] elements)
```

Keeps only `https://developer.android.com/reference/androidx/collection/MutableLongList#retainAll(kotlin.LongArray)` in the `https://developer.android.com/reference/androidx/collection/MutableLongList` and removes all other values.

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` has changed. |

### retainAll

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

```
public final boolean retainAll(@NonNull LongList elements)
```

Keeps only `https://developer.android.com/reference/androidx/collection/MutableLongList#retainAll(androidx.collection.LongList)` in the `https://developer.android.com/reference/androidx/collection/MutableLongList` and removes all other values.

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/collection/MutableLongList` has changed. |

### set

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

```
public final long set(@IntRange(from = 0) int index, long element)
```

Sets the value at `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)` to `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)`.

| Returns |
|---|---|
| `long` | the previous value set at `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)` |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableLongList#set(kotlin.Int,kotlin.Long)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/LongList#lastIndex()`, inclusive |

### sort

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

```
public final void sort()
```

Sorts the `https://developer.android.com/reference/androidx/collection/MutableLongList` elements in ascending order.

### sortDescending

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

```
public final void sortDescending()
```

Sorts the `https://developer.android.com/reference/androidx/collection/MutableLongList` elements in descending order.

### trim

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

```
public final void trim(int minCapacity)
```

Reduces the internal storage. If `https://developer.android.com/reference/androidx/collection/MutableLongList#capacity()` is greater than `https://developer.android.com/reference/androidx/collection/MutableLongList#trim(kotlin.Int)` and `https://developer.android.com/reference/androidx/collection/LongList#size()`, the internal storage is reduced to the maximum of `https://developer.android.com/reference/androidx/collection/LongList#size()` and `https://developer.android.com/reference/androidx/collection/MutableLongList#trim(kotlin.Int)`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableLongList#ensureCapacity(kotlin.Int)` |   |