# LazyLayoutKeyIndexMap

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt+class:androidx.compose.foundation.lazy.layout.LazyLayoutKeyIndexMap) Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface LazyLayoutKeyIndexMap
  ```

*** ** * ** ***

A key-index mapping that can be used by the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider` to keep track of indices and keys in `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayout.composable#LazyLayout(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.layout.LazyLayoutPrefetchState,androidx.compose.foundation.lazy.layout.LazyLayoutMeasurePolicy)`.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap#getIndex(kotlin.Any)(key: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap#getKey(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |

## Public functions

### getIndex

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
fun getIndex(key: Any): Int
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | current index for given `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap#getIndex(kotlin.Any)` or `-1` if not found. |

### getKey

Cmn Added in [1.10.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.10.0)

```
fun getKey(index: Int): Any?
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | key for a given `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap#getKey(kotlin.Int)` if it is known, or null otherwise. |