# ItemList

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/ItemList.java+class:androidx.car.app.model.ItemList) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***


```
@CarProtocol
class ItemList
```

<br />

*** ** * ** ***

Represents a list of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Item` instances. `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList` instances are used by templates that contain lists of models, such as for example, the list of `https://developer.android.com/reference/kotlin/androidx/car/app/model/Row`s in a `https://developer.android.com/reference/kotlin/androidx/car/app/model/ListTemplate`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList`. |
| `interface https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.OnItemVisibilityChangedListener` A listener for handling item visibility changes. |
| `interface https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.OnSelectedListener` A listener for handling selection events for lists with selectable items. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/car/app/model/Item!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#getItems()()` Returns the list of items in this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList`. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarText?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#getNoItemsMessage()()` Returns the app-supplied text to be displayed if the list is empty or `null` if the default text will be used by the host. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnItemVisibilityChangedDelegate?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#getOnItemVisibilityChangedDelegate()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnItemVisibilityChangedDelegate` to be called when the visible items in the list changes or `null` if one hasn't been set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnSelectedDelegate?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#getOnSelectedDelegate()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnSelectedDelegate` to be called when when an item is selected by the user or `null` is the list is non-selectable. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#getSelectedIndex()()` Returns the index of the selected item of the list. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#hashCode()()` |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#toBuilder()()` Creates and returns a new `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder` initialized with this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList`'s data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList#toString()()` |

## Public functions

### equals

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

### getItems

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getItems(): (Mutable)List<Item!>
```

Returns the list of items in this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder#addItem(androidx.car.app.model.Item)` |   |

### getNoItemsMessage

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getNoItemsMessage(): CarText?
```

Returns the app-supplied text to be displayed if the list is empty or `null` if the default text will be used by the host.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder#setNoItemsMessage(java.lang.CharSequence)` |   |

### getOnItemVisibilityChangedDelegate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getOnItemVisibilityChangedDelegate(): OnItemVisibilityChangedDelegate?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnItemVisibilityChangedDelegate` to be called when the visible items in the list changes or `null` if one hasn't been set.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder#setOnItemsVisibilityChangedListener(androidx.car.app.model.ItemList.OnItemVisibilityChangedListener)` |   |

### getOnSelectedDelegate

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getOnSelectedDelegate(): OnSelectedDelegate?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/OnSelectedDelegate` to be called when when an item is selected by the user or `null` is the list is non-selectable.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder#setOnSelectedListener(androidx.car.app.model.ItemList.OnSelectedListener)` |   |

### getSelectedIndex

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

```
fun getSelectedIndex(): Int
```

Returns the index of the selected item of the list.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder#setSelectedIndex(int)` |   |

### hashCode

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

### toBuilder

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

```
fun toBuilder(): ItemList.Builder
```

Creates and returns a new `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList.Builder` initialized with this `https://developer.android.com/reference/kotlin/androidx/car/app/model/ItemList`'s data.

### toString

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