# MutableIntList

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

*** ** * ** ***


```
public final class MutableIntList extends IntList
```

<br />

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

*** ** * ** ***

`https://developer.android.com/reference/androidx/collection/MutableIntList` 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/-int/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/IntList`, 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/IntList#forEach(kotlin.Function1)`, for example. However, concurrent reads are safe.

## Summary

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

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

### Inherited methods

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

Returns `true` if there's at least one element in the collection.
`final boolean` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList#any(kotlin.Function1)`.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/IntList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)` in the range defined by `https://developer.android.com/reference/androidx/collection/IntList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)` and `https://developer.android.com/reference/androidx/collection/IntList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Int)`.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList` or its range for an element for which the given `https://developer.android.com/reference/androidx/collection/IntList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Function1)` function returns zero using binary search algorithm.
`final boolean` `https://developer.android.com/reference/androidx/collection/IntList#contains(kotlin.Int)(int element)`

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

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

Returns the number of elements in this list.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList#count(kotlin.Function1)`.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/IntList#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/IntList#elementAt(kotlin.Int)` is out of bounds of this collection.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.html> defaultValue
)`

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

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

Returns the first element in the `https://developer.android.com/reference/androidx/collection/IntList` 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/IntList#isEmpty()`.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList` for which `https://developer.android.com/reference/androidx/collection/IntList#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/IntList#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/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull R> operation
)`

Accumulates values, starting with `https://developer.android.com/reference/androidx/collection/IntList#fold(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/androidx/collection/IntList#fold(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/androidx/collection/IntList` 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/IntList#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/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull R> operation
)`

Accumulates values, starting with `https://developer.android.com/reference/androidx/collection/IntList#foldIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/androidx/collection/IntList#foldIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/androidx/collection/IntList` 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/IntList#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/Integer.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/IntList#foldRight(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/androidx/collection/IntList#foldRight(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/androidx/collection/IntList` 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/IntList#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/Integer.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/IntList#foldRightIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/androidx/collection/IntList#foldRightIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/androidx/collection/IntList` in reverse order.
`final void` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block)`

Calls `https://developer.android.com/reference/androidx/collection/IntList#forEach(kotlin.Function1)` for each element in the `https://developer.android.com/reference/androidx/collection/IntList`, in order.
`final void` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block
)`

Calls `https://developer.android.com/reference/androidx/collection/IntList#forEachIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/androidx/collection/IntList` along with its index, in order.
`final void` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block)`

Calls `https://developer.android.com/reference/androidx/collection/IntList#forEachReversed(kotlin.Function1)` for each element in the `https://developer.android.com/reference/androidx/collection/IntList` in reverse order.
`final void` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> block
)`

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

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

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

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

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

Returns the index of `https://developer.android.com/reference/androidx/collection/IntList#indexOf(kotlin.Int)` in the `https://developer.android.com/reference/androidx/collection/IntList` or `-1` if `https://developer.android.com/reference/androidx/collection/IntList#indexOf(kotlin.Int)` is not there.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList` for which `https://developer.android.com/reference/androidx/collection/IntList#indexOfFirst(kotlin.Function1)` returns `true`.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList` for which `https://developer.android.com/reference/androidx/collection/IntList#indexOfLast(kotlin.Function1)` returns `true`.
`final boolean` `https://developer.android.com/reference/androidx/collection/IntList#isEmpty()()`

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

Returns `true` if there are elements in the `https://developer.android.com/reference/androidx/collection/IntList` 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/IntList#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/IntList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` and using `https://developer.android.com/reference/androidx/collection/IntList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence)` before and `https://developer.android.com/reference/androidx/collection/IntList#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/IntList#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/Integer.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/IntList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` and using `https://developer.android.com/reference/androidx/collection/IntList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` before and `https://developer.android.com/reference/androidx/collection/IntList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` after, if supplied.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#last()()`

Returns the last element in the `https://developer.android.com/reference/androidx/collection/IntList` 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/IntList#isEmpty()`.
`final int` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList` for which `https://developer.android.com/reference/androidx/collection/IntList#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/IntList#lastIndexOf(kotlin.Int)(int element)`

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

Returns `true` if the collection has no elements in it.
`final boolean` `https://developer.android.com/reference/androidx/collection/IntList#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/Integer.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/IntList#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/IntList#toString()()`

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

## Public constructors

### MutableIntList

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

```
public MutableIntList(int initialCapacity)
```

Creates a `https://developer.android.com/reference/androidx/collection/MutableIntList` with a `https://developer.android.com/reference/androidx/collection/MutableIntList#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(int element)
```

Adds `https://developer.android.com/reference/androidx/collection/MutableIntList#add(kotlin.Int)` to the `https://developer.android.com/reference/androidx/collection/MutableIntList` 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, int element)
```

Adds `https://developer.android.com/reference/androidx/collection/MutableIntList#add(kotlin.Int,kotlin.Int)` to the `https://developer.android.com/reference/androidx/collection/MutableIntList` at the given `https://developer.android.com/reference/androidx/collection/MutableIntList#add(kotlin.Int,kotlin.Int)`, shifting over any elements at `https://developer.android.com/reference/androidx/collection/MutableIntList#add(kotlin.Int,kotlin.Int)` 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/MutableIntList#add(kotlin.Int,kotlin.Int)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/IntList#size()`, inclusive |

### addAll

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

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

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

### addAll

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

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

Adds all `https://developer.android.com/reference/androidx/collection/MutableIntList#addAll(androidx.collection.IntList)` to the end of the `https://developer.android.com/reference/androidx/collection/MutableIntList` and returns `true` if the `https://developer.android.com/reference/androidx/collection/MutableIntList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableIntList#addAll(androidx.collection.IntList)` 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 int[] elements)
```

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

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/collection/MutableIntList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableIntList#addAll(kotlin.Int,kotlin.IntArray)` 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/MutableIntList#addAll(kotlin.Int,kotlin.IntArray)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/IntList#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 IntList elements)
```

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

| Returns |
|---|---|
| `boolean` | `true` if the `https://developer.android.com/reference/androidx/collection/MutableIntList` was changed or `false` if `https://developer.android.com/reference/androidx/collection/MutableIntList#addAll(kotlin.Int,androidx.collection.IntList)` 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/MutableIntList#addAll(kotlin.Int,androidx.collection.IntList)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/IntList#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/MutableIntList`. The storage isn't released.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableIntList#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/MutableIntList#ensureCapacity(kotlin.Int)` elements in the `https://developer.android.com/reference/androidx/collection/MutableIntList`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/collection/MutableIntList#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/MutableIntList` must grow.

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

### minusAssign

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

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

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

### minusAssign

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

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

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

### minusAssign

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

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

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

### plusAssign

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

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

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

### plusAssign

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

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

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

### plusAssign

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

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

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

### remove

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

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

Removes `https://developer.android.com/reference/androidx/collection/MutableIntList#remove(kotlin.Int)` from the `https://developer.android.com/reference/androidx/collection/MutableIntList`. If `https://developer.android.com/reference/androidx/collection/MutableIntList#remove(kotlin.Int)` was in the `https://developer.android.com/reference/androidx/collection/MutableIntList` 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 int[] elements)
```

Removes all `https://developer.android.com/reference/androidx/collection/MutableIntList#removeAll(kotlin.IntArray)` from the `https://developer.android.com/reference/androidx/collection/MutableIntList` 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 IntList elements)
```

Removes all `https://developer.android.com/reference/androidx/collection/MutableIntList#removeAll(androidx.collection.IntList)` from the `https://developer.android.com/reference/androidx/collection/MutableIntList` 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 int removeAt(@IntRange(from = 0) int index)
```

Removes the element at the given `https://developer.android.com/reference/androidx/collection/MutableIntList#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/MutableIntList#removeAt(kotlin.Int)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/IntList#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/MutableIntList#removeRange(kotlin.Int,kotlin.Int)` (inclusive) to `https://developer.android.com/reference/androidx/collection/MutableIntList#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/MutableIntList#removeRange(kotlin.Int,kotlin.Int)` or `https://developer.android.com/reference/androidx/collection/MutableIntList#removeRange(kotlin.Int,kotlin.Int)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/IntList#size()`, inclusive |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableIntList#removeRange(kotlin.Int,kotlin.Int)` is greater than `https://developer.android.com/reference/androidx/collection/MutableIntList#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 int[] elements)
```

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

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

### retainAll

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

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

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

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

### set

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

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

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

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

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/collection/MutableIntList#set(kotlin.Int,kotlin.Int)` isn't between 0 and `https://developer.android.com/reference/androidx/collection/IntList#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/MutableIntList` 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/MutableIntList` 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/MutableIntList#capacity()` is greater than `https://developer.android.com/reference/androidx/collection/MutableIntList#trim(kotlin.Int)` and `https://developer.android.com/reference/androidx/collection/IntList#size()`, the internal storage is reduced to the maximum of `https://developer.android.com/reference/androidx/collection/IntList#size()` and `https://developer.android.com/reference/androidx/collection/MutableIntList#trim(kotlin.Int)`.

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