arrow-fx-coroutines / arrow.fx.coroutines / IQueue

IQueue

data class ~~IQueue~~<A> : Iterable<A> Deprecated: IQueue is a collection type internal to Arrow Fx Coroutines, and will no longer be exposed in 0.13.0

Port of scala.collection.immutable.Queue

IQueue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.

IQueue is implemented as a pair of Lists, one containing the ‘‘in’’ elements and the other the ‘‘out’’ elements. Elements are added to the ‘‘in’’ list and removed from the ‘‘out’’ list. When the ‘‘out’’ list runs dry, the queue is pivoted by replacing the ‘‘out’’ list by ‘‘in.reverse’’, and ‘‘in’’ by ‘‘Nil’’.

Properties

size an O(1) size method.val size: Int

Functions

all fun all(p: (A) -> Boolean): Boolean
dequeue fun dequeue(): Pair<A, IQueue<A>>
dequeueOrNull fun dequeueOrNull(): Pair<A, IQueue<A>>?
drop fun drop(n: Int): IQueue<A>
enqueue fun enqueue(elem: A): IQueue<A>
fun enqueue(elems: Iterable<A>): IQueue<A>
exists fun exists(p: (A) -> Boolean): Boolean
filter fun filter(p: (A) -> Boolean): IQueue<A>
filterNot fun filterNot(p: (A) -> Boolean): IQueue<A>
firstOrNull fun firstOrNull(): A?
isEmpty fun isEmpty(): Boolean
isNotEmpty fun isNotEmpty(): Boolean
iterator fun iterator(): Iterator<A>
prepend fun prepend(elem: A): IQueue<A>
tailOrNull fun tailOrNull(): IQueue<A>?
toList fun toList(): List<A>
toString fun toString(): String

Companion Object Functions

empty fun <A> empty(): IQueue<A>
invoke operator fun <A> invoke(vararg a: A): IQueue<A>
operator fun <A> invoke(a: A): IQueue<A>
operator fun <A> invoke(a: List<A>): IQueue<A>

Do you like Arrow?

Arrow Org
<