MutableIntervalList


Mutable version of IntervalList. It allows you to add new intervals via addInterval.

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

Public constructors

Cmn

Public functions

Unit
addInterval(size: Int, value: T)

Adds a new interval into this list.

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

Allows to iterate through all the intervals starting from the one containing fromIndex until the one containing toIndex.

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

Returns the interval containing the given index.

Cmn

Public properties

open Int

The total amount of items in all the intervals.

Cmn

Public constructors

MutableIntervalList

<T : Any?> MutableIntervalList()

Public functions

addInterval

fun addInterval(size: Int, value: T): Unit

Adds a new interval into this list.

Parameters
size: Int

the amount of items in the new interval.

value: T

the value representing this interval.

forEach

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

Allows to iterate through all the intervals starting from the one containing fromIndex until the one containing toIndex.

Parameters
fromIndex: Int

we will start iterating from the interval containing this index.

toIndex: Int

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

open 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

open 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.