VirtualBuffer

class VirtualBuffer<out 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

Link copied to clipboard
fun <out T> VirtualBuffer(size: Int, generator: (Int) -> T)

Functions

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

Gets element at given index.

Link copied to clipboard
open operator override fun iterator(): Iterator<T>

Iterates over all elements.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
open override val size: Int

The size of this buffer.

Sources

Link copied to clipboard