arrow-fx-coroutines / arrow.fx.coroutines.stream / Chunk / Queue

Queue

class Queue<A> : Iterable<A>

A FIFO queue of chunks that provides an O(1) size method and provides the ability to take and drop individual elements while preserving the chunk structure as much as possible.

This is similar to a queue of individual elements but chunk structure is maintained.

Properties

chunks val chunks: IQueue<Chunk<A>>
size val size: Int

Functions

drop Drops the first n elements of this chunk queue in a way that preserves chunk structure.fun drop(n: Int): Queue<A>
dropLast Drops the last n elements of this chunk queue in a way that preserves chunk structure.fun dropLast(n: Int): Queue<A>
enqueue Enqueue a chunk to the end of this chunk queue.fun enqueue(c: Chunk<A>): Queue<A>
equals fun equals(other: Any?): Boolean
hashCode fun hashCode(): Int
isEmpty fun isEmpty(): Boolean
isNotEmpty fun isNotEmpty(): Boolean
iterator fun iterator(): Iterator<A>
take Takes the first n elements of this chunk queue in a way that preserves chunk structure.fun take(n: Int): Queue<A>
takeLast Takes the last n elements of this chunk queue in a way that preserves chunk structure.fun takeLast(n: Int): Queue<A>
toChunk Converts this chunk queue to a single chunk, copying all chunks to a single chunk.fun toChunk(): Chunk<A>
toString fun toString(): String

Companion Object Functions

empty fun <A> empty(): Queue<A>
invoke operator fun <A> invoke(vararg chunks: Chunk<A>): Queue<A>
operator fun <A> invoke(chunks: Iterable<Chunk<A>>): Queue<A>
queueFirstN Creates a chunk consisting of the first n elements of queue and returns the remainder.fun <A> queueFirstN(n: Int, q: IQueue<A>): Pair<Chunk<A>, IQueue<A>>

Do you like Arrow?

Arrow Org
<