KoneVirtualList
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
Converts this KoneIterable to a KoneSequence by returning this iterable's iterators.
fun <Element> KoneIterable<Element>.containsAllFrom(elements: KoneIterable<Element>): Boolean
Checks if the iterable is not empty.
Initiates an iterator over the collection's elements with pointer before the first element.
Initiates an iterator over the collection's elements with pointer between elements with indices index - 1 and index correspondingly.
Converts this iterable to a KoneList.
Converts this iterable to a KoneMutableList.
Converts this iterable to a KoneMutableNoddedList.
Converts this iterable to a KoneNoddedList.
Converts this iterable to a KoneSettableList.
Converts this iterable to a KoneSettableNoddedList.