# ObjectList

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  sealed class ObjectList<E : Any?>
  ```
Known direct subclasses [MutableObjectList](https://developer.android.com/reference/kotlin/androidx/collection/MutableObjectList)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableObjectList` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableObjectList` is a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html`-like collection for reference types. |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` is a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html`-like collection for reference types. It is optimized for fast access, avoiding virtual and interface method access. Methods avoid allocation whenever possible. For example `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEach(kotlin.Function1)` does not need allocate an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterator/index.html`.

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/kotlin/androidx/collection/ObjectList#forEach(kotlin.Function1)`, for example. However, concurrent reads are safe.

**Note** `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` access is available through `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#asList()` when developers need access to the common API.

It is best to use this for all internal implementations where a list of reference types is needed. Use `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` in public API to take advantage of the commonly-used interface. It is common to use `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` internally and use `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#asList()` to get a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` interface for interacting with public APIs.

LongList

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableObjectList` |   |
| `https://developer.android.com/reference/kotlin/androidx/collection/FloatList` |   |
| `https://developer.android.com/reference/kotlin/androidx/collection/IntList` |   |

## Summary

| ### Protected constructors |
|---|---|
| `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#ObjectList(kotlin.Int)(initialCapacity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#any()()` Returns `true` if there's at least one element in the collection. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#any(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns `true` if any of the elements give a `true` return value for `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#any(kotlin.Function1)`. | Cmn |
| `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<E>` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#asList()()` Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` view into the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Function1)( fromIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, toIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, comparison: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for an element for which the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Int,kotlin.Int,kotlin.Function1)` function returns zero using binary search algorithm. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Any,kotlin.Comparator,kotlin.Int,kotlin.Int)( element: E, comparator: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-comparator/index.html<E>, fromIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, toIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for the provided `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Any,kotlin.Comparator,kotlin.Int,kotlin.Int)` using the specified `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Any,kotlin.Comparator,kotlin.Int,kotlin.Int)` across elements. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-comparable/index.html<K>> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearchBy(kotlin.Comparable,kotlin.Int,kotlin.Int,kotlin.Function1)( key: K?, fromIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, toIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, crossinline selector: (element) -> K? )` Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for an element having a key returned by `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearchBy(kotlin.Comparable,kotlin.Int,kotlin.Int,kotlin.Function1)` equal to the specified `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearchBy(kotlin.Comparable,kotlin.Int,kotlin.Int,kotlin.Function1)` using binary search algorithm. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#contains(kotlin.Any)(element: E)` Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#contains(kotlin.Any)` or `false` otherwise. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.Array)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>)` Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains all elements in `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.Array)` or `false` if one or more are missing. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.collections.Iterable)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>)` Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains all elements in `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.collections.Iterable)` or `false` if one or more are missing. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.collections.List)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<E>)` Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains all elements in `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.collections.List)` or `false` if one or more are missing. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(androidx.collection.ObjectList)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>)` Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains all elements in `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(androidx.collection.ObjectList)` or `false` if one or more are missing. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#count()()` Returns the number of elements in this list. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#count(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Counts the number of elements matching `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#count(kotlin.Function1)`. | Cmn |
| `E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAt(kotlin.Int)(index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the element at the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#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/kotlin/androidx/collection/ObjectList#elementAt(kotlin.Int)` is out of bounds of this collection. | Cmn |
| `inline E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)(index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, defaultValue: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> E)` Returns the element at the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` or `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` if `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` is out of bounds of the collection. | Cmn |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Returns `true` if `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#equals(kotlin.Any)` is a `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` and the contents of this and `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#equals(kotlin.Any)` are the same. | Cmn |
| `E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#first()()` Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or throws a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`. | Cmn |
| `inline E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#first(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#first(kotlin.Function1)` returns `true` or throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if nothing matches. | Cmn |
| `inline E?` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#firstOrNull()()` Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `null` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`. | Cmn |
| `inline E?` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#firstOrNull(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#firstOrNull(kotlin.Function1)` returns `true` or `null` if nothing matches. | Cmn |
| `inline R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#fold(kotlin.Any,kotlin.Function2)(initial: R, operation: (acc, element) -> R)` Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#fold(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#fold(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in order. | Cmn |
| `inline R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldIndexed(kotlin.Any,kotlin.Function3)(initial: R, operation: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, acc, element) -> R)` Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in order. | Cmn |
| `inline R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRight(kotlin.Any,kotlin.Function2)(initial: R, operation: (element, acc) -> R)` Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRight(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRight(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in reverse order. | Cmn |
| `inline R` | `<R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRightIndexed(kotlin.Any,kotlin.Function3)(initial: R, operation: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, element, acc) -> R)` Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRightIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRightIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in reverse order. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEach(kotlin.Function1)(block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEach(kotlin.Function1)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`, in order. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachIndexed(kotlin.Function2)(block: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` along with its index, in order. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachReversed(kotlin.Function1)(block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachReversed(kotlin.Function1)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in reverse order. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachReversedIndexed(kotlin.Function2)(block: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachReversedIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` along with its index, in reverse order. | Cmn |
| `operator E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#get(kotlin.Int)(index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the element at the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#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/kotlin/androidx/collection/ObjectList#get(kotlin.Int)` is out of bounds of this collection. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#hashCode()()` Returns a hash code based on the contents of the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOf(kotlin.Any)(element: E)` Returns the index of `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOf(kotlin.Any)` in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `-1` if `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOf(kotlin.Any)` is not there. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfFirst(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the index if the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfFirst(kotlin.Function1)` returns `true` or -1 if there was no element for which predicate returned `true`. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfLast(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the index if the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfLast(kotlin.Function1)` returns `true` or -1 if there was no element for which predicate returned `true`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()()` Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` has no elements in it or `false` otherwise. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isNotEmpty()()` Returns `true` if there are elements in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `false` if it is empty. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)( separator: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, prefix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, postfix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, limit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, truncated: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html, transform: ((E) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)? )` Creates a String from the elements separated by `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` and using `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` before and `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` after, if supplied. | Cmn |
| `E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#last()()` Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or throws a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`. | Cmn |
| `inline E` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#last(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#last(kotlin.Function1)` returns `true` or throws `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if nothing matches. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastIndexOf(kotlin.Any)(element: E)` Returns the index of the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` that is the same as `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastIndexOf(kotlin.Any)` or `-1` if no elements match. | Cmn |
| `inline E?` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastOrNull()()` Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `null` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`. | Cmn |
| `inline E?` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastOrNull(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastOrNull(kotlin.Function1)` returns `true` or `null` if nothing matches. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#none()()` Returns `true` if the collection has no elements in it. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#reversedAny(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns `true` if any of the elements give a `true` return value for `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#reversedAny(kotlin.Function1)` while iterating in the reverse order. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#toString()()` Returns a String representation of the list, surrounded by "\[\]" and each element separated by ", ". | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indices()` Returns an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` of the valid indices for this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastIndex()` Returns the last valid index in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#size()` The number of elements in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-comparable/index.html<E>> https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>.https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#(androidx.collection.ObjectList).binarySearch(kotlin.Comparable,kotlin.Int,kotlin.Int)( element: E, fromIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, toIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for the provided `https://developer.android.com/reference/kotlin/androidx/collection/package-summary#(androidx.collection.ObjectList).binarySearch(kotlin.Comparable,kotlin.Int,kotlin.Int)` using binary search algorithm. | Cmn |

## Protected constructors

### ObjectList

Cmn

```
protected <E : Any?> ObjectList(initialCapacity: Int)
```

## Public functions

### any

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

```
fun any(): Boolean
```

Returns `true` if there's at least one element in the collection.

### any

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

```
inline fun any(predicate: (element) -> Boolean): Boolean
```

Returns `true` if any of the elements give a `true` return value for `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#any(kotlin.Function1)`.

### asList

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

```
abstract fun asList(): List<E>
```

Returns a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` view into the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. All access to the collection will be less efficient and abides by the allocation requirements of the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html`. For example, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/index.html` will allocate an iterator. All access will go through the more expensive interface calls. Critical performance areas should use the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` API rather than `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` API, when possible.

### binarySearch

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

```
inline fun binarySearch(
    fromIndex: @IntRange(from = 0) Int = 0,
    toIndex: @IntRange(from = 0) Int = _size,
    comparison: (element) -> Int
): Int
```

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

### binarySearch

Cmn

```
fun binarySearch(
    element: E,
    comparator: Comparator<E>,
    fromIndex: @IntRange(from = 0) Int = 0,
    toIndex: @IntRange(from = 0) Int = _size
): Int
```

Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for the provided `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Any,kotlin.Comparator,kotlin.Int,kotlin.Int)` using the specified `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Any,kotlin.Comparator,kotlin.Int,kotlin.Int)` across elements. The list is expected to be sorted in order specified by `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearch(kotlin.Any,kotlin.Comparator,kotlin.Int,kotlin.Int)`.

### binarySearchBy

Cmn

```
inline fun <K : Comparable<K>> binarySearchBy(
    key: K?,
    fromIndex: @IntRange(from = 0) Int = 0,
    toIndex: @IntRange(from = 0) Int = _size,
    crossinline selector: (element) -> K?
): Int
```

Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for an element having a key returned by `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearchBy(kotlin.Comparable,kotlin.Int,kotlin.Int,kotlin.Function1)` equal to the specified `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearchBy(kotlin.Comparable,kotlin.Int,kotlin.Int,kotlin.Function1)` using binary search algorithm. The list is expected to be sorted in ascending order according to the natural ordering of keys produced by `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#binarySearchBy(kotlin.Comparable,kotlin.Int,kotlin.Int,kotlin.Function1)`.

### contains

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

```
operator fun contains(element: E): Boolean
```

Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#contains(kotlin.Any)` or `false` otherwise.

### containsAll

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

```
fun containsAll(elements: Array<E>): Boolean
```

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

### containsAll

Cmn

```
fun containsAll(elements: Iterable<E>): Boolean
```

Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains all elements in `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.collections.Iterable)` or `false` if one or more are missing.

### containsAll

Cmn

```
fun containsAll(elements: List<E>): Boolean
```

Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` contains all elements in `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#containsAll(kotlin.collections.List)` or `false` if one or more are missing.

### containsAll

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

```
fun containsAll(elements: ObjectList<E>): Boolean
```

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

### count

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

```
fun count(): Int
```

Returns the number of elements in this list.

### count

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

```
inline fun count(predicate: (element) -> Boolean): Int
```

Counts the number of elements matching `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#count(kotlin.Function1)`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of elements in this list for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#count(kotlin.Function1)` returns true. |

### elementAt

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

```
fun elementAt(index: @IntRange(from = 0) Int): E
```

Returns the element at the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#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/kotlin/androidx/collection/ObjectList#elementAt(kotlin.Int)` is out of bounds of this collection.

### elementAtOrElse

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

```
inline fun elementAtOrElse(index: @IntRange(from = 0) Int, defaultValue: (index: Int) -> E): E
```

Returns the element at the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` or `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` if `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` is out of bounds of the collection.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index of the element whose value should be returned |
| `defaultValue: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) -> E` | A lambda to call with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#elementAtOrElse(kotlin.Int,kotlin.Function1)` as a parameter to return a value at an index not in the list. |

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

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

### first

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

```
fun first(): E
```

Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or throws a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`.

### first

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

```
inline fun first(predicate: (element) -> Boolean): E
```

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfFirst(kotlin.Function1)` |   |
| `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#firstOrNull()` |   |

### firstOrNull

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

```
inline fun firstOrNull(): E?
```

Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `null` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`.

### firstOrNull

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

```
inline fun firstOrNull(predicate: (element) -> Boolean): E?
```

Returns the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#firstOrNull(kotlin.Function1)` returns `true` or `null` if nothing matches.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfFirst(kotlin.Function1)` |   |

### fold

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

```
inline fun <R : Any?> fold(initial: R, operation: (acc, element) -> R): R
```

Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#fold(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#fold(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in order.

| Parameters |
|---|---|
| `initial: R` | The value of `acc` for the first call to `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#fold(kotlin.Any,kotlin.Function2)` or return value if there are no elements in this list. |
| `operation: (acc, element) -> R` | function that takes current accumulator value and an element, and calculates the next accumulator value. |

### foldIndexed

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

```
inline fun <R : Any?> foldIndexed(initial: R, operation: (index: Int, acc, element) -> R): R
```

Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in order.

### foldRight

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

```
inline fun <R : Any?> foldRight(initial: R, operation: (element, acc) -> R): R
```

Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRight(kotlin.Any,kotlin.Function2)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRight(kotlin.Any,kotlin.Function2)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in reverse order.

| Parameters |
|---|---|
| `initial: R` | The value of `acc` for the first call to `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRight(kotlin.Any,kotlin.Function2)` or return value if there are no elements in this list. |
| `operation: (element, acc) -> R` | function that takes an element and the current accumulator value, and calculates the next accumulator value. |

### foldRightIndexed

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

```
inline fun <R : Any?> foldRightIndexed(initial: R, operation: (index: Int, element, acc) -> R): R
```

Accumulates values, starting with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRightIndexed(kotlin.Any,kotlin.Function3)`, and applying `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#foldRightIndexed(kotlin.Any,kotlin.Function3)` to each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in reverse order.

### forEach

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

```
inline fun forEach(block: (element) -> Unit): Unit
```

Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEach(kotlin.Function1)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`, in order.

| Parameters |
|---|---|
| `block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | will be executed for every element in the list, accepting an element from the list |

### forEachIndexed

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

```
inline fun forEachIndexed(block: (index: Int, element) -> Unit): Unit
```

Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` along with its index, in order.

| Parameters |
|---|---|
| `block: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | will be executed for every element in the list, accepting the index and the element at that index. |

### forEachReversed

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

```
inline fun forEachReversed(block: (element) -> Unit): Unit
```

Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachReversed(kotlin.Function1)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` in reverse order.

| Parameters |
|---|---|
| `block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | will be executed for every element in the list, accepting an element from the list |

### forEachReversedIndexed

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

```
inline fun forEachReversedIndexed(block: (index: Int, element) -> Unit): Unit
```

Calls `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#forEachReversedIndexed(kotlin.Function2)` for each element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` along with its index, in reverse order.

| Parameters |
|---|---|
| `block: (index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | will be executed for every element in the list, accepting the index and the element at that index. |

### get

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

```
operator fun get(index: @IntRange(from = 0) Int): E
```

Returns the element at the given `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#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/kotlin/androidx/collection/ObjectList#get(kotlin.Int)` is out of bounds of this collection.

### hashCode

Cmn

```
open fun hashCode(): Int
```

Returns a hash code based on the contents of the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`.

### indexOf

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

```
fun indexOf(element: E): Int
```

Returns the index of `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOf(kotlin.Any)` in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `-1` if `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOf(kotlin.Any)` is not there.

### indexOfFirst

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

```
inline fun indexOfFirst(predicate: (element) -> Boolean): Int
```

Returns the index if the first element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfFirst(kotlin.Function1)` returns `true` or -1 if there was no element for which predicate returned `true`.

### indexOfLast

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

```
inline fun indexOfLast(predicate: (element) -> Boolean): Int
```

Returns the index if the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfLast(kotlin.Function1)` returns `true` or -1 if there was no element for which predicate returned `true`.

### isEmpty

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

```
fun isEmpty(): Boolean
```

Returns `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` has no elements in it or `false` otherwise.

### isNotEmpty

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

```
fun isNotEmpty(): Boolean
```

Returns `true` if there are elements in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `false` if it is empty.

### joinToString

Cmn

```
fun joinToString(
    separator: CharSequence = ", ",
    prefix: CharSequence = "",
    postfix: CharSequence = "",
    limit: Int = -1,
    truncated: CharSequence = "...",
    transform: ((E) -> CharSequence)? = null
): String
```

Creates a String from the elements separated by `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` and using `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` before and `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` after, if supplied.

When a non-negative value of `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` is provided, a maximum of `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` items are used to generate the string. If the collection holds more than `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` items, the string is terminated with `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)`.

`https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` may be supplied to convert each element to a custom String.

### last

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

```
fun last(): E
```

Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or throws a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`.

### last

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

```
inline fun last(predicate: (element) -> Boolean): E
```

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfLast(kotlin.Function1)` |   |
| `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastOrNull()` |   |

### lastIndexOf

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

```
fun lastIndexOf(element: E): Int
```

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

### lastOrNull

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

```
inline fun lastOrNull(): E?
```

Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or `null` if it `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#isEmpty()`.

### lastOrNull

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

```
inline fun lastOrNull(predicate: (element) -> Boolean): E?
```

Returns the last element in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` for which `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#lastOrNull(kotlin.Function1)` returns `true` or `null` if nothing matches.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#indexOfLast(kotlin.Function1)` |   |

### none

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

```
fun none(): Boolean
```

Returns `true` if the collection has no elements in it.

### reversedAny

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

```
inline fun reversedAny(predicate: (element) -> Boolean): Boolean
```

Returns `true` if any of the elements give a `true` return value for `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList#reversedAny(kotlin.Function1)` while iterating in the reverse order.

### toString

Cmn

```
open fun toString(): String
```

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

## Public properties

### indices

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

```
val indices: IntRange
```

Returns an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html` of the valid indices for this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`.

### lastIndex

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

```
val lastIndex: Int
```

Returns the last valid index in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`. This can be `-1` when the list is empty.

### size

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

```
val size: Int
```

The number of elements in the `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList`.

## Extension functions

### ObjectList.binarySearch

Cmn Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/ObjectList.kt+function:binarySearch)

```
fun <E : Comparable<E>> ObjectList<E>.binarySearch(
    element: E,
    fromIndex: @IntRange(from = 0) Int = 0,
    toIndex: @IntRange(from = 0) Int = size
): Int
```

Searches this `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` or its range for the provided `https://developer.android.com/reference/kotlin/androidx/collection/package-summary#(androidx.collection.ObjectList).binarySearch(kotlin.Comparable,kotlin.Int,kotlin.Int)` using binary search algorithm. The list is expected to be sorted in ascending order according to the natural ordering of elements.