VirtualBuffer

class VirtualBuffer<T>(size: Int, generator: (Int) -> T) : Buffer<T>

A buffer with content calculated on-demand. The calculated content is not stored, so it is recalculated on each call. Useful when one needs single element from the buffer.

Parameters

T

the type of elements provided by the buffer.

Constructors

VirtualBuffer
Link copied to clipboard
common
fun <T> VirtualBuffer(size: Int, generator: (Int) -> T)
the type of elements provided by the buffer.

Functions

get
Link copied to clipboard
common
open operator override fun get(index: Int): T
Gets element at given index.
iterator
Link copied to clipboard
common
open operator override fun iterator(): Iterator<T>
Iterates over all elements.

Properties

size
Link copied to clipboard
common
open override val size: Int
The size of this buffer.