# SparseArrayObjectAdapter

# SparseArrayObjectAdapter

Artifact:[androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback)  
[View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/SparseArrayObjectAdapter.java+class:androidx.leanback.widget.SparseArrayObjectAdapter)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/widget/SparseArrayObjectAdapter "View this page in Java")

<br />

```
class SparseArrayObjectAdapter : ObjectAdapter
```

<br />

|---|---|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)                                                                          |||
| ↳ | [androidx.leanback.widget.ObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter)                          ||
|   | ↳ | [androidx.leanback.widget.SparseArrayObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter) |

*** ** * ** ***

An[ObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter)implemented with a[android.util.SparseArray](https://developer.android.com/reference/android/util/SparseArray.html). This class maintains an array of objects where each object is associated with an integer key which determines its order relative to other objects.

## Summary

|                                                                                                                                                                                                                                    ### Public constructors                                                                                                                                                                                                                                    |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [SparseArrayObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#SparseArrayObjectAdapter())`()` Constructs an adapter.                                                                                                                                                                                                                                                                                                            |
| [SparseArrayObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#SparseArrayObjectAdapter(androidx.leanback.widget.Presenter))`(presenter: `[Presenter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/Presenter)`!)` Constructs an adapter with the given[Presenter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/Presenter).                                                 |
| [SparseArrayObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#SparseArrayObjectAdapter(androidx.leanback.widget.PresenterSelector))`(presenterSelector: `[PresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/PresenterSelector)`!)` Constructs an adapter with the given[PresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/PresenterSelector). |

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [clear](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#clear())`()` Removes all items from this adapter, leaving it empty.                                                                                                                                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [clear](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#clear(int))`(key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Clears the given key and associated item from the adapter.                                                                                                                                               |
| [Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?`      | [get](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#get(int))`(position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns the item for the given position.                                                                                                                                                                |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [indexOf](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#indexOf(java.lang.Object))`(item: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!)` Returns the index for the given item in the adapter.                                                                                                                                  |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [indexOf](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#indexOf(int))`(key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns the index for the given key in the adapter.                                                                                                                                                  |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isImmediateNotifySupported](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#isImmediateNotifySupported())`()` Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise.                                                                                                                                            |
| [Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!`      | [lookup](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#lookup(int))`(key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns the object for the given key, or null if no mapping for that key exists.                                                                                                                       |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [notifyArrayItemRangeChanged](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#notifyArrayItemRangeChanged(int,int))`(positionStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, itemCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Notify that the content of a range of items changed. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [set](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#set(int,java.lang.Object))`(key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, item: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!)` Sets the item for the given key.                                                                      |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | [size](https://developer.android.com/reference/kotlin/androidx/leanback/widget/SparseArrayObjectAdapter#size())`()` Returns the number of items in the adapter.                                                                                                                                                                                                                                                     |

|                                                                                                                                                                                                                                                                                                      ### Inherited Constants                                                                                                                                                                                                                                                                                                      |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.leanback.widget.ObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter) |-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------| | `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [NO_ID](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#NO_ID())` = -1` Indicates that an id has not been set. | |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[androidx.leanback.widget.ObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter) |----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                                  | [getId](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#getId(int))`(position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns the id for the given position.                                                                                                                                                                                                                                                  | | [Presenter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/Presenter)`?`              | [getPresenter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#getPresenter(java.lang.Object))`(item: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`)` Returns the[Presenter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/Presenter)for the given item from the adapter.                                                                                                                    | | [PresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/PresenterSelector) | [getPresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#getPresenterSelector())`()` Returns the presenter selector for this ObjectAdapter.                                                                                                                                                                                                                                                                                              | | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                            | [hasStableIds](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#hasStableIds())`()` Returns true if the item ids are stable across changes to the underlying data.                                                                                                                                                                                                                                                                                      | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [notifyChanged](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#notifyChanged())`()` Notifies UI that the underlying data has changed.                                                                                                                                                                                                                                                                                                                 | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [notifyItemMoved](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#notifyItemMoved(int,int))`(fromPosition: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, toPosition: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Notifies UI that item at fromPosition has been moved to toPosition.                                                                                              | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [notifyItemRangeChanged](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#notifyItemRangeChanged(int,int))`(positionStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, itemCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Notifies UI that some items has changed.                                                                                                           | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [notifyItemRangeChanged](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#notifyItemRangeChanged(int,int,java.lang.Object))`(positionStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, itemCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, payload: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` Notifies UI that some items has changed. | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [notifyItemRangeInserted](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#notifyItemRangeInserted(int,int))`(positionStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, itemCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Notifies UI that new items has been inserted.                                                                                                    | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [notifyItemRangeRemoved](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#notifyItemRangeRemoved(int,int))`(positionStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, itemCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Notifies UI that some items that has been removed.                                                                                                 | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [onHasStableIdsChanged](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#onHasStableIdsChanged())`()` Called when[setHasStableIds](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#setHasStableIds(boolean))is called and the status of stable ids has changed.                                                                                                                                                   | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [onPresenterSelectorChanged](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#onPresenterSelectorChanged())`()` Called when[setPresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#setPresenterSelector(androidx.leanback.widget.PresenterSelector))is called and the PresenterSelector differs from the previous one.                                                                             | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [registerObserver](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#registerObserver(androidx.leanback.widget.ObjectAdapter.DataObserver))`(observer: `[ObjectAdapter.DataObserver](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter.DataObserver)`)` Registers a DataObserver for data change notifications.                                                                                                      | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [setHasStableIds](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#setHasStableIds(boolean))`(hasStableIds: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Sets whether the item ids are stable across changes to the underlying data.                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [setPresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#setPresenterSelector(androidx.leanback.widget.PresenterSelector))`(presenterSelector: `[PresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/PresenterSelector)`)` Sets the presenter selector.                                                                                                                                           | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [unregisterAllObservers](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#unregisterAllObservers())`()` Unregisters all DataObservers for this ObjectAdapter.                                                                                                                                                                                                                                                                                           | | [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                  | [unregisterObserver](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter#unregisterObserver(androidx.leanback.widget.ObjectAdapter.DataObserver))`(observer: `[ObjectAdapter.DataObserver](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter.DataObserver)`)` Unregisters a DataObserver for data change notifications.                                                                                                | |

## Public constructors

### SparseArrayObjectAdapter

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

```
SparseArrayObjectAdapter()
```

Constructs an adapter.  

### SparseArrayObjectAdapter

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

```
SparseArrayObjectAdapter(presenter: Presenter!)
```

Constructs an adapter with the given[Presenter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/Presenter).  

### SparseArrayObjectAdapter

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

```
SparseArrayObjectAdapter(presenterSelector: PresenterSelector!)
```

Constructs an adapter with the given[PresenterSelector](https://developer.android.com/reference/kotlin/androidx/leanback/widget/PresenterSelector).  

## Public functions

### clear

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

```
fun clear(): Unit
```

Removes all items from this adapter, leaving it empty.  

### clear

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

```
fun clear(key: Int): Unit
```

Clears the given key and associated item from the adapter.  

|                                     Parameters                                     |
|------------------------------------------------------------------------------------|------------------------|
| `key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The key to be cleared. |

### get

```
fun get(position: Int): Any?
```

Returns the item for the given position.  

### indexOf

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

```
fun indexOf(item: Any!): Int
```

Returns the index for the given item in the adapter.  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|--------------------------------|
| `item: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!` | The item to find in the array. |

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Index of the item, or a negative value if not found. |

### indexOf

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

```
fun indexOf(key: Int): Int
```

Returns the index for the given key in the adapter.  

|                                     Parameters                                     |
|------------------------------------------------------------------------------------|-------------------------------|
| `key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The key to find in the array. |

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Index of the item, or a negative value if not found. |

### isImmediateNotifySupported

```
fun isImmediateNotifySupported(): Boolean
```

Returns true if the adapter pairs each underlying data change with a call to notify and false otherwise.  

### lookup

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

```
fun lookup(key: Int): Any!
```

Returns the object for the given key, or null if no mapping for that key exists.  

### notifyArrayItemRangeChanged

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

```
fun notifyArrayItemRangeChanged(positionStart: Int, itemCount: Int): Unit
```

Notify that the content of a range of items changed. Note that this is not same as items being added or removed.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|----------------------------------------------|
| `positionStart: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The position of first item that has changed. |
| `itemCount: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | The count of how many items have changed.    |

### set

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

```
fun set(key: Int, item: Any!): Unit
```

Sets the item for the given key.  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|-----------------------------------|
| `key: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | The key associated with the item. |
| `item: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!` | The item associated with the key. |

### size

```
fun size(): Int
```

Returns the number of items in the adapter.