# LazyLayoutIntervalContent

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/LazyLayoutIntervalContent.kt+class:androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.3.0) Common/AllAndroid/JVM
- Cmn

  ```
  abstract class LazyLayoutIntervalContent<Interval : LazyLayoutIntervalContent.Interval>
  ```

*** ** * ** ***

Common parts backing the interval-based content of lazy layout defined through `item` DSL.

Note: this class is a part of `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)` harness that allows for building custom lazy layouts. LazyLayout and all corresponding APIs are still under development and are subject to change.

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.Interval` Common content of individual intervals in `item` DSL of lazy layouts. |

| ### Public constructors |
|---|---|
| `<Interval : https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.Interval> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#LazyLayoutIntervalContent()()` | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#getContentType(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns content type based on a global index. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#getKey(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns item key based on a global index. | Cmn |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#withInterval(kotlin.Int,kotlin.Function2)( globalIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, block: (localIntervalIndex: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, content) -> T )` Runs a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#withInterval(kotlin.Int,kotlin.Function2)` on the content of the interval associated with the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#withInterval(kotlin.Int,kotlin.Function2)` with providing a local index in the given interval. | Cmn |

| ### Public properties |
|---|---|---|
| `abstract https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/IntervalList<Interval>` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#intervals()` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#itemCount()` The total amount of items in all the intervals. | Cmn |

## Public constructors

### LazyLayoutIntervalContent

Cmn

```
<Interval : LazyLayoutIntervalContent.Interval> LazyLayoutIntervalContent()
```

## Public functions

### getContentType

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

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

Returns content type based on a global index.

### getKey

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

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

Returns item key based on a global index.

### withInterval

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

```
inline fun <T : Any?> withInterval(
    globalIndex: Int,
    block: (localIntervalIndex: Int, content) -> T
): T
```

Runs a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#withInterval(kotlin.Int,kotlin.Function2)` on the content of the interval associated with the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent#withInterval(kotlin.Int,kotlin.Function2)` with providing a local index in the given interval.

## Public properties

### intervals

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

```
abstract val intervals: IntervalList<Interval>
```

### itemCount

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

```
val itemCount: Int
```

The total amount of items in all the intervals.