KCircularBuffer

constructor(capacity: Int, initialItems: List<T> = emptyList())(source)

Parameters

capacity

The maximum number of items the buffer can retain. Must be ≥ 1.

initialItems

Optional list of items to pre-populate the buffer with (ordered oldest to newest). If the list size exceeds capacity, only the last capacity items are kept.

Type Parameters

T

The type of elements held in this buffer.