KoneVirtualList
class KoneVirtualList<Element>(val size: UInt, generator: (index: UInt) -> Element) : KoneList<Element> (source)
Represents an immutable list which elements are not stored anywhere but are generated with generator function instead on each access.
Implementation details
This implementation holds only size value and generator function. Each time value with index i
is accessed, generator is invoked on i
and the result is returned. The result is not stored anywhere.
Time complexity of operations
Be aware that the formulas do not include generator time invocation!
Operation | Worst case | Average |
---|---|---|
size | \(\Theta(1)\) | \(\Theta(1)\) |
get | \(\Theta(1)\) | \(\Theta(1)\) |
iterator | \(\Theta(1)\) | \(\Theta(1)\) |
iteratorFrom | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.hasNext | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.hasPrevious | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.getNext | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.getPrevious | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.moveNext | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.movePrevious | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.nextIndex | \(\Theta(1)\) | \(\Theta(1)\) |
iterator.previousIndex | \(\Theta(1)\) | \(\Theta(1)\) |
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <Element, Key> KoneIterable<Element>.associateBy(keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, keySelector: (Element) -> Key): KoneMap<Key, Element>
inline fun <Element, Key, Value> KoneIterable<Element>.associateBy(keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, keySelector: (Element) -> Key, valueTransform: (Element) -> Value): KoneMap<Key, Value>
Link copied to clipboard
inline fun <Element, Key> KoneIterable<Element>.associateByReified(keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, keySelector: (Element) -> Key): KoneReifiedMap<Key, Element>
inline fun <Element, Key, Value> KoneIterable<Element>.associateByReified(keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, keySelector: (Element) -> Key, valueTransform: (Element) -> Value): KoneReifiedMap<Key, Value>
inline fun <Element, Key> KoneIterable<Element>.associateByReified(keyReification: Reification<Key>, keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, keySelector: (Element) -> Key): KoneReifiedMap<Key, Element>
inline fun <Element, Key, Value> KoneIterable<Element>.associateByReified(keyReification: Reification<Key>, keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, keySelector: (Element) -> Key, valueTransform: (Element) -> Value): KoneReifiedMap<Key, Value>
inline fun <T, K> KoneIterable<T>.associateByReified(keyEquality: Equality<K> = defaultEquality(), keyHashing: Hashing<K>? = null, keyOrder: Order<K>? = null, keySelector: (T) -> K, resolve: (key: K, currentValue: T, newValue: T) -> T): KoneReifiedMap<K, T>
inline fun <T, K, V> KoneIterable<T>.associateByReified(keyEquality: Equality<K> = defaultEquality(), keyHashing: Hashing<K>? = null, keyOrder: Order<K>? = null, keySelector: (T) -> K, valueTransform: (T) -> V, resolve: (key: K, currentValue: V, newValue: V) -> V): KoneReifiedMap<K, V>
inline fun <T, K> KoneIterable<T>.associateByReified(keyReification: Reification<K>, keyEquality: Equality<K> = defaultEquality(), keyHashing: Hashing<K>? = null, keyOrder: Order<K>? = null, keySelector: (T) -> K, resolve: (key: K, currentValue: T, newValue: T) -> T): KoneReifiedMap<K, T>
inline fun <T, K, V> KoneIterable<T>.associateByReified(keyReification: Reification<K>, keyEquality: Equality<K> = defaultEquality(), keyHashing: Hashing<K>? = null, keyOrder: Order<K>? = null, keySelector: (T) -> K, valueTransform: (T) -> V, resolve: (key: K, currentValue: V, newValue: V) -> V): KoneReifiedMap<K, V>
Link copied to clipboard
inline fun <Element, Key, Destination : KoneMutableMap<in Key, in Element>> KoneIterable<Element>.associateByTo(destination: Destination, keySelector: (Element) -> Key): Destination
inline fun <Element, Key, Value, Destination : KoneMutableMap<in Key, in Value>> KoneIterable<Element>.associateByTo(destination: Destination, keySelector: (Element) -> Key, valueTransform: (Element) -> Value): Destination
Link copied to clipboard
inline fun <Element, Key, Value> KoneIterable<Element>.associateReified(keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, transform: (Element) -> KoneMapEntry<Key, Value>): KoneReifiedMap<Key, Value>
inline fun <Element, Key, Value> KoneIterable<Element>.associateReified(keyReification: Reification<Key>, keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, transform: (Element) -> KoneMapEntry<Key, Value>): KoneReifiedMap<Key, Value>
Link copied to clipboard
inline fun <Element, Key, Value, Destination : KoneMutableMap<in Key, in Value>> KoneIterable<Element>.associateTo(destination: Destination, transform: (Element) -> KoneMapEntry<Key, Value>): Destination
Link copied to clipboard
inline fun <Key, Value> KoneIterable<Key>.associateWithReified(keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, valueSelector: (Key) -> Value): KoneReifiedMap<Key, Value>
inline fun <Key, Value> KoneIterable<Key>.associateWithReified(keyReification: Reification<Key>, keyEquality: Equality<Key> = defaultEquality(), keyHashing: Hashing<Key>? = null, keyOrder: Order<Key>? = null, valueSelector: (Key) -> Value): KoneReifiedMap<Key, Value>
Link copied to clipboard
inline fun <Key, Value, Destination : KoneMutableMap<in Key, in Value>> KoneIterable<Key>.associateWithTo(destination: Destination, valueSelector: (Key) -> Value): Destination
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.firstOfThatOrNull(transform: (E) -> R, predicate: (R) -> Boolean): R?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.flatMapIndexed(transform: (index: UInt, E) -> KoneIterable<R>): KoneList<R>
Link copied to clipboard
inline fun <E, R, D : KoneMutableList<in R>> KoneIterable<E>.flatMapIndexedTo(destination: D, transform: (index: UInt, E) -> KoneIterable<R>): D
inline fun <E, R, D : KoneMutableSet<in R>> KoneIterable<E>.flatMapIndexedTo(destination: D, transform: (index: UInt, E) -> KoneIterable<R>): D
Link copied to clipboard
inline fun <E, R, D : KoneMutableList<in R>> KoneIterable<E>.flatMapTo(destination: D, transform: (E) -> KoneIterable<R>): D
inline fun <E, R, D : KoneMutableSet<in R>> KoneIterable<E>.flatMapTo(destination: D, transform: (E) -> KoneIterable<R>): D
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, K> KoneIterable<E>.groupContextualBy(keyType: SuppliedType<K>, keySelector: (E) -> K): KoneMap<K, KoneList<E>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R : Comparable<R>> KoneIterable<E>.heapsortedByDescending(selector: (E) -> R): KoneList<E>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.heapsortedWithBy(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.heapsortedWithByDescending(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
Link copied to clipboard
Checks if the iterable is not empty.
Link copied to clipboard
Initiates an iterator over the collection's elements with pointer before the first element.
Link copied to clipboard
Initiates an iterator over the collection's elements with pointer between elements with indices index - 1
and index
correspondingly.
Link copied to clipboard
fun <E, A : Appendable> KoneIterable<E>.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: UInt = UInt.MAX_VALUE, truncated: CharSequence = "...", transform: (E) -> CharSequence? = null): A
Link copied to clipboard
fun <E> KoneIterable<E>.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: UInt = UInt.MAX_VALUE, truncated: CharSequence = "...", transform: (E) -> CharSequence? = null): String
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R, D : KoneMutableList<in R>> KoneIterable<E>.mapIndexedTo(destination: D, transform: (index: UInt, E) -> R): D
inline fun <E, R, D : KoneMutableSet<in R>> KoneIterable<E>.mapIndexedTo(destination: D, transform: (index: UInt, E) -> R): D
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <E, R> KoneIterable<E>.maxListWithBy(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
fun <E, R> KoneIterable<E>.maxListWithOf(comparator: Comparator<R>, selector: (E) -> R): KoneList<R>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <E, R> KoneIterable<E>.minListWithBy(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
fun <E, R> KoneIterable<E>.minListWithOf(comparator: Comparator<R>, selector: (E) -> R): KoneList<R>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R : Comparable<R>> KoneIterable<E>.quicksortedByDescending(selector: (E) -> R): KoneList<E>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.quicksortedWithBy(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.quicksortedWithByDescending(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R : Comparable<R>> KoneIterable<E>.sortedByDescending(selector: (E) -> R): KoneList<E>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.sortedWithBy(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
inline fun <E, R> KoneIterable<E>.sortedWithByDescending(comparator: Comparator<R>, selector: (E) -> R): KoneList<E>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <Element> KoneIterable<Element>.toKoneContextualMutableReifiedSet(elementType: SuppliedType<Element>): KoneMutableReifiedSet<Element>
Link copied to clipboard
fun <Element> KoneIterable<Element>.toKoneContextualMutableSet(elementType: SuppliedType<Element>): KoneMutableSet<Element>
Link copied to clipboard
fun <Element> KoneIterable<Element>.toKoneContextualReifiedSet(elementType: SuppliedType<Element>): KoneReifiedSet<Element>
Link copied to clipboard
fun <Element> KoneIterable<Element>.toKoneContextualSet(elementType: SuppliedType<Element>): KoneSet<Element>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <Element> KoneIterable<Element>.toKoneMutableReifiedSet(elementEquality: Equality<Element> = defaultEquality(), elementHashing: Hashing<Element>? = null, elementOrder: Order<Element>? = null): KoneMutableReifiedSet<Element>
fun <Element> KoneIterable<Element>.toKoneMutableReifiedSet(elementReification: Reification<Element>, elementEquality: Equality<Element> = defaultEquality(), elementHashing: Hashing<Element>? = null, elementOrder: Order<Element>? = null): KoneMutableReifiedSet<Element>
Link copied to clipboard
fun <Element> KoneIterable<Element>.toKoneMutableSet(elementEquality: Equality<Element> = defaultEquality(), elementHashing: Hashing<Element>? = null, elementOrder: Order<Element>? = null): KoneMutableSet<Element>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun <Element> KoneIterable<Element>.toKoneReifiedSet(elementEquality: Equality<Element> = defaultEquality(), elementHashing: Hashing<Element>? = null, elementOrder: Order<Element>? = null): KoneReifiedSet<Element>
fun <Element> KoneIterable<Element>.toKoneReifiedSet(elementReification: Reification<Element>, elementEquality: Equality<Element> = defaultEquality(), elementHashing: Hashing<Element>? = null, elementOrder: Order<Element>? = null): KoneReifiedSet<Element>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard