RingBuffer

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

Thread-safe ring buffer

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open operator override fun get(index: Int): T
Link copied to clipboard
fun isFull(): Boolean
Link copied to clipboard
open operator override fun iterator(): Iterator<T>

Iterator could provide wrong results if buffer is changed in initialization (iteration is safe)

Link copied to clipboard
suspend fun push(element: T)
Link copied to clipboard
suspend fun snapshot(): Buffer<T>

A safe snapshot operation

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

Properties

Link copied to clipboard
open override var size: Int

Sources

Link copied to clipboard