IntervalList

Known direct subclasses
MutableIntervalList

Mutable version of IntervalList.


The list consisting of multiple intervals.

It is useful when you want to define your own dsl similar to the one used by LazyColumn where list items can be defined via multiple item/items calls.

This interface is read only, in order to create a list you need to use MutableIntervalList.

Parameters
<T : Any?>

type of values each interval contains in Interval.value.

Note: this class is a part of LazyLayout 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

The interval holder.

Public functions

Unit
forEach(
    fromIndex: Int,
    toIndex: Int,
    block: (IntervalList.Interval<T>) -> Unit
)

Iterates through all the intervals starting from the one containing fromIndex until the one containing toIndex.

Cmn
operator IntervalList.Interval<T>
get(index: Int)

Returns the interval containing the given index.

Cmn

Public properties

Int

The total amount of items in all the intervals.

Cmn

Public functions

forEach

fun forEach(
    fromIndex: Int = 0,
    toIndex: Int = size - 1,
    block: (IntervalList.Interval<T>) -> Unit
): Unit

Iterates through all the intervals starting from the one containing fromIndex until the one containing toIndex.

Parameters
fromIndex: Int = 0

we will start iterating from the interval containing this index.

toIndex: Int = size - 1

the last interval we iterate through will contain this index. This index should be not smaller than fromIndex.

Throws
kotlin.IndexOutOfBoundsException

if the indexes are not within 0..size - 1 range.

get

operator fun get(index: Int): IntervalList.Interval<T>

Returns the interval containing the given index.

Throws
kotlin.IndexOutOfBoundsException

if the index is not within 0..size - 1 range.

Public properties

size

val sizeInt

The total amount of items in all the intervals.

Note that it is not the amount of intervals, but the sum of Interval.size for all the intervals added into this list.