InPlaceSubList

A sublist view of a sourceList that provides access to a portion of the list within the specified range (start, end). Modifications to the original list are reflected in the sublist.

This class does not modify the original list and only provides read-only access to the sublist.

Properties

Link copied to clipboard
open override val size: Int

Returns the size of this sublist.

Functions

Link copied to clipboard
inline fun <T> List<T>.atLeast(n: Int, predicate: (T) -> Boolean): Boolean

Returns true if at least n elements in the list match the given predicate.

Link copied to clipboard
inline fun <T> List<T>.atMost(n: Int, predicate: (T) -> Boolean): Boolean

Returns true if at most n elements in the list match the given predicate.

Link copied to clipboard
fun <T> List<T>.chunkedInPlace(chunkSize: Int): ChunkedList<T>

Splits this list into a list of InPlaceSubList each not exceeding the given chunkSize. The last list may have less elements than the given chunkSize.

Link copied to clipboard
open operator override fun contains(element: T): Boolean
Link copied to clipboard
open override fun containsAll(elements: Collection<T>): Boolean
Link copied to clipboard
fun <T> List<T>.dropInPlace(n: Int): List<T>

Returns a sublist containing all elements except first n elements. The sublist is a view into the original list. Changes in the original list will be reflected in the sublist.

Link copied to clipboard

Returns a sublist containing all elements except last n elements. The sublist is a view into the original list. Changes in the original list will be reflected in the sublist.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
inline fun fastForEach(action: (T) -> Unit)

Performs the given action for each element in this sublist.

Link copied to clipboard
inline fun fastForEachIndexed(action: (index: Int, T) -> Unit)

Performs the given action for each element in this sublist, providing its index relative to this sublist.

Link copied to clipboard
inline fun List<Double>.filter(predicate: (Double) -> Boolean): DoubleList

Returns a DoubleList containing only elements matching the given predicate.

inline fun List<Float>.filter(predicate: (Float) -> Boolean): FloatList

Returns a FloatList containing only elements matching the given predicate.

inline fun List<Int>.filter(predicate: (Int) -> Boolean): IntList

Returns a IntList containing only elements matching the given predicate.

inline fun List<Long>.filter(predicate: (Long) -> Boolean): LongList

Returns a LongList containing only elements matching the given predicate.

Link copied to clipboard
fun <T> List<List<T>>.filterFlattened(predicate: (T) -> Boolean): List<T>

Returns a flattened list containing only the elements that match the given predicate.

Returns a flattened DoubleList containing only elements that match the given predicate.

Returns a flattened FloatList containing only elements that match the given predicate.

fun List<List<Int>>.filterFlattened(predicate: (Int) -> Boolean): IntList

Returns a flattened IntList containing only elements that match the given predicate.

Returns a flattened LongList containing only elements that match the given predicate.

Link copied to clipboard
inline fun List<Double>.filterNot(predicate: (Double) -> Boolean): DoubleList

Returns a DoubleList containing only elements NOT matching the given predicate.

inline fun List<Float>.filterNot(predicate: (Float) -> Boolean): FloatList

Returns a FloatList containing only elements NOT matching the given predicate.

inline fun List<Int>.filterNot(predicate: (Int) -> Boolean): IntList

Returns a IntList containing only elements NOT matching the given predicate.

inline fun List<Long>.filterNot(predicate: (Long) -> Boolean): LongList

Returns a LongList containing only elements NOT matching the given predicate.

Link copied to clipboard

Returns a DoubleList containing all non-null elements.

Returns a FloatList containing all non-null elements.

Returns a IntList containing all non-null elements.

Returns a LongList containing all non-null elements.

Link copied to clipboard
fun <T> List<List<T>>.findFlattened(predicate: (T) -> Boolean): T?

Finds the first element in the nested lists that matches predicate, or returns null if none found (generic version).

Link copied to clipboard
@JvmName(name = "flatMapList")
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> List<Double>): DoubleList
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> DoubleList): DoubleList

Returns a single DoubleList of all elements yielded from results of transform function being invoked on each element of original collection.

@JvmName(name = "flatMapList")
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> List<Float>): FloatList
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> FloatList): FloatList

Returns a single FloatList of all elements yielded from results of transform function being invoked on each element of original collection.

@JvmName(name = "flatMapList")
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> List<Int>): IntList
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> IntList): IntList

Returns a single IntList of all elements yielded from results of transform function being invoked on each element of original collection.

@JvmName(name = "flatMapList")
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> List<Long>): LongList
inline fun <T> List<T>.flatMap(computeSize: Boolean = false, transform: (T) -> LongList): LongList

Returns a single LongList of all elements yielded from results of transform function being invoked on each element of original collection.

Link copied to clipboard
@JvmName(name = "flattenListDouble")
inline fun List<List<Double>>.flatten(): DoubleList

Flattens a List of List into a single DoubleList.

@JvmName(name = "flattenListFloat")
inline fun List<List<Float>>.flatten(): FloatList

Flattens a List of List into a single FloatList.

@JvmName(name = "flattenListInt")
inline fun List<List<Int>>.flatten(): IntList

Flattens a List of List into a single IntList.

@JvmName(name = "flattenListLong")
inline fun List<List<Long>>.flatten(): LongList

Flattens a List of List into a single LongList.

Flattens a List of DoubleList into a single DoubleList.

Flattens a List of FloatList into a single FloatList.

inline fun List<IntList>.flatten(): IntList

Flattens a List of IntList into a single IntList.

inline fun List<LongList>.flatten(): LongList

Flattens a List of LongList into a single LongList.

Link copied to clipboard
inline fun <T> List<T>.forEachChunk(chunkSize: Int, action: (InPlaceSubList<T>) -> Unit)

Iterates through the windowed chunks of this collection with given chunkSize, where window step is equals to chunkSize and calls action on each chunk.

Link copied to clipboard
inline fun <T> List<T>.forEachChunkIndexed(chunkSize: Int, action: (index: Int, InPlaceSubList<T>) -> Unit)

Iterates through the windowed chunks of this collection with given chunkSize, where window step is equals to chunkSize and calls action on each chunk with its index.

Link copied to clipboard
fun <T> List<List<T>>.forEachFlattened(action: (T) -> Unit)

Iterates over each element in all nested lists and applies the given action.

Link copied to clipboard
inline fun <T> List<T>.forEachWindow(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (InPlaceSubList<T>) -> Unit)

Iterates through the windows of the list and performs the given action on each window.

Link copied to clipboard
inline fun <T> List<T>.forEachWindowIndexed(windowSize: Int, step: Int = 1, partialWindows: Boolean = false, action: (index: Int, InPlaceSubList<T>) -> Unit)

Iterates through the windows of the list with their indices and performs the given action on each window.

Link copied to clipboard
open operator override fun get(index: Int): T

Returns the element at the specified index in this sublist.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun indexOf(element: T): Int
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun iterator(): Iterator<T>
Link copied to clipboard
open override fun lastIndexOf(element: T): Int
Link copied to clipboard
open override fun listIterator(): ListIterator<T>
open override fun listIterator(index: Int): ListIterator<T>
Link copied to clipboard
inline fun <T> List<T>.map(transform: (T) -> Double): DoubleList

Returns a DoubleList containing the results of applying the given transform function to each element in the original list.

inline fun <T> List<T>.map(transform: (T) -> Float): FloatList

Returns a FloatList containing the results of applying the given transform function to each element in the original list.

inline fun <T> List<T>.map(transform: (T) -> Int): IntList

Returns a IntList containing the results of applying the given transform function to each element in the original list.

inline fun <T> List<T>.map(transform: (T) -> Long): LongList

Returns a LongList containing the results of applying the given transform function to each element in the original list.

Link copied to clipboard
fun <T, E> List<List<T>>.mapFlattened(transform: (T) -> E): List<E>

Returns a flattened list produced by applying transform to each element of the nested lists (generic version).

fun <T> List<List<T>>.mapFlattened(transform: (T) -> Double): DoubleList

Returns a flattened DoubleList produced by applying transform to each element of the nested lists.

fun <T> List<List<T>>.mapFlattened(transform: (T) -> Float): FloatList

Returns a flattened FloatList produced by applying transform to each element of the nested lists.

fun <T> List<List<T>>.mapFlattened(transform: (T) -> Int): IntList

Returns a flattened IntList produced by applying transform to each element of the nested lists.

fun <T> List<List<T>>.mapFlattened(transform: (T) -> Long): LongList

Returns a flattened LongList produced by applying transform to each element of the nested lists.

Link copied to clipboard
inline fun <T> List<T>.mapIndexed(transform: (Int, T) -> Double): DoubleList

Returns a DoubleList containing the results of applying the given transform function to each element and its index in the original list.

inline fun <T> List<T>.mapIndexed(transform: (Int, T) -> Float): FloatList

Returns a FloatList containing the results of applying the given transform function to each element and its index in the original list.

inline fun <T> List<T>.mapIndexed(transform: (Int, T) -> Int): IntList

Returns a IntList containing the results of applying the given transform function to each element and its index in the original list.

inline fun <T> List<T>.mapIndexed(transform: (Int, T) -> Long): LongList

Returns a LongList containing the results of applying the given transform function to each element and its index in the original list.

Link copied to clipboard
inline fun <T> List<T>.mapNotNull(transform: (T) -> Double?): DoubleList
inline fun <T> List<T>.mapNotNull(transform: (T) -> Float?): FloatList
inline fun <T> List<T>.mapNotNull(transform: (T) -> Int?): IntList
inline fun <T> List<T>.mapNotNull(transform: (T) -> Long?): LongList

Returns a list containing only the non-null results of applying the given transform function to each element in the original list.

Link copied to clipboard
open override fun subList(fromIndex: Int, toIndex: Int): List<T>
Link copied to clipboard
fun <T> List<T>.takeInPlace(n: Int): List<T>

Returns a sublist of the first n elements. The sublist is a view into the original list. Changes in the original list will be reflected in the sublist.

Link copied to clipboard

Returns a sublist of the last n elements. The sublist is a view into the original list. Changes in the original list will be reflected in the sublist.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun <T> List<T>.windowedInPlace(windowSize: Int, step: Int = 1, partialWindows: Boolean = false): WindowedList<T>

Returns a list of windows with the given windowSize sliding with the given step. Each window is a view into the original list. Changes in the original list will be reflected in the windows.