IntervalList
-
Cmn
sealed interface IntervalList<T : Any?>
MutableIntervalList |
Mutable version of |
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 Note: this class is a part of |
Summary
Nested types |
---|
class IntervalList.Interval<T : Any?> The interval holder. |
Public functions |
||
---|---|---|
Unit |
forEach( Iterates through all the intervals starting from the one containing |
Cmn
|
operator IntervalList.Interval<T> |
Returns the interval containing the given |
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 |
block: (IntervalList.Interval<T>) -> Unit |
will be invoked on each interval within the defined indexes |
Throws | |
---|---|
kotlin.IndexOutOfBoundsException |
if the indexes are not within 0.. |
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.. |
Public properties
size
val size: Int
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.