RingBuffer

class RingBuffer<T>(buffer: MutableBuffer<T?>, startIndex: Int, size: Int) : Buffer<T>

Thread-safe ring buffer

Constructors

RingBuffer
Link copied to clipboard
common
fun <T> RingBuffer(buffer: MutableBuffer<T?>, startIndex: Int = 0, size: Int = 0)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

get
Link copied to clipboard
common
open operator override fun get(index: Int): T
isFull
Link copied to clipboard
common
fun isFull(): Boolean
iterator
Link copied to clipboard
common
open operator override fun iterator(): Iterator<T>
Iterator could provide wrong results if buffer is changed in initialization (iteration is safe)
push
Link copied to clipboard
common
suspend fun push(element: T)
snapshot
Link copied to clipboard
common
suspend fun snapshot(): Buffer<T>
A safe snapshot operation
toString
Link copied to clipboard
common
open override fun toString(): String

Properties

size
Link copied to clipboard
common
open override var size: Int

Sources

common source
Link copied to clipboard