apidocs / com.nimmsta.core.android.uart / AtomicBuffer

AtomicBuffer

class AtomicBuffer<T> : Collection<T>

Implements a thread-safe FIFO queue, which supports searching, slicing etc. It is based on a LinkedList, which means pop and push is pretty efficient.

Author
NIMMSTA Team

Copyright
NIMMSTA GmbH & IBPG 2020

License
NIMMSTA GmbH

Constructors

<init>

Implements a thread-safe FIFO queue, which supports searching, slicing etc. It is based on a LinkedList, which means pop and push is pretty efficient.

AtomicBuffer()

Properties

size

val size: Int

Functions

add

fun add(element: T): Unit
fun add(index: Int, element: T): Unit

addAll

fun addAll(index: Int, elements: AtomicBuffer<T>): Unit

clear

fun clear(): Unit

contains

fun contains(element: T): Boolean

containsAll

fun containsAll(elements: Collection<T>): Boolean

find

fun find(predicate: (t: T) -> Boolean): T?

findLast

fun findLast(predicate: (t: T) -> Boolean): T?

firstOrNull

fun firstOrNull(): T?

forEach

fun forEach(action: (T) -> Unit): Unit

indexOf

fun indexOf(element: T): Int

indexOfFirst

fun indexOfFirst(predicate: (t: T) -> Boolean): Int

indexOfLast

fun indexOfLast(predicate: (t: T) -> Boolean): Int

isEmpty

fun isEmpty(): Boolean

iterator

fun iterator(): Iterator<T>

joinToString

fun joinToString(separator: String): String

lastOrNull

fun lastOrNull(): T?

pop

fun pop(): T?

popUntilMax

fun popUntilMax(maxElements: Int): Unit

push

fun push(element: T): Unit

remove

fun remove(find: T?): Unit

removeAll

fun removeAll(elements: AtomicBuffer<T>): Unit
fun removeAll(predicate: (T) -> Boolean): Boolean

removeAt

fun removeAt(index: Int): Unit

slice

fun slice(intRange: IntRange): AtomicBuffer<T>