RingBuffer

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

Thread-safe ring buffer

Constructors

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

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun <T> Buffer<T>.asFlow(): Flow<T>

Create a Flow from buffer

Link copied to clipboard
open operator override fun get(index: Int): T
Link copied to clipboard
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