arrow-fx / arrow.fx.internal / IQueue

IQueue

class ~~IQueue~~<A> : Iterable<A> Deprecated: The IO datatype and it’s related type classes will disappear in Arrow 0.13.0. All useful operations are offered directly over suspend functions by Arrow Fx Coroutines. https://arrow-kt.io/docs/fx/async/

Port of scala.collection.immutable.Queue Queue objects implement data structures that allow to insert and retrieve elements in a first-in-first-out (FIFO) manner.

Queue 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

lIn val lIn: List<A>
lOut val lOut: List<A>

Functions

dequeue fun dequeue(): Tuple2<A, IQueue<A>>
dequeueOption fun dequeueOption(): Option<Tuple2<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>
forAll fun forAll(p: (A) -> Boolean): Boolean
front fun front(): A
head fun head(): A
isEmpty fun isEmpty(): Boolean
isNotEmpty fun isNotEmpty(): Boolean
iterator fun iterator(): Iterator<A>
length fun length(): Int
tail fun tail(): 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
<