arrow-fx-coroutines / arrow.fx.coroutines.stream / Chunk
abstract class ~~Chunk~~<out O>
Deprecated: Chunk is deprecated as part of Stream deprecation.
Strict, finite sequence of values that allows index-based random access of elements.
Chunk
s can be created from a variety of collection types using methods on the Chunk
companion
i.e. Chunk, Chunk.iterable, Chunk.array. Additionally, the Chunk
companion
defines a subtype of Chunk
for each primitive type, using an unboxed primitive array.
The operations on Chunk
are all defined strictly. For example, c.map(f).map(g).map(h)
results in
intermediate chunks being created (1 per call to map
).
Booleans | class Booleans : Chunk < Boolean > |
Boxed | class Boxed<O> : Chunk <O> |
Bytes | class Bytes : Chunk < Byte > |
Doubles | class Doubles : Chunk < Double > |
Empty | object Empty : Chunk < Nothing > |
Floats | class Floats : Chunk < Float > |
Ints | class Ints : Chunk < Int > |
Longs | class Longs : Chunk < Long > |
Queue | 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.class Queue<A> : Iterable <A> |
Shorts | class Shorts : Chunk < Short > |
Singleton | class Singleton<O> : Chunk <O> |
<init> | Strict, finite sequence of values that allows index-based random access of elements.Chunk() |
all | Returns true if the predicate passes for all elements.fun all(p: (O) -> Boolean ): Boolean |
any | fun any(p: (O) -> Boolean ): Boolean |
copyToArray_ | abstract fun copyToArray_(xs: Array < Any ?>, start: Int ): Unit |
drop | Drops the first n elements of this chunk.open fun drop(n: Int ): Chunk <O> |
dropLast | Returns a list containing all elements except last n elements.fun dropLast(n: Int ): Chunk <O> |
equals | open fun equals(other: Any ?): Boolean |
filter | Returns a chunk that has only the elements that satisfy the supplied predicate.fun filter(p: (O) -> Boolean ): Chunk <O> |
find | kotlin-std exposes same aliasfun find(p: (O) -> Boolean ): O? |
findLast | kotlin-std exposes same aliasfun findLast(p: (O) -> Boolean ): O? |
firstOrNull | Gets the first element of this chunk.fun firstOrNull(): O? Returns the first element for which the predicate returns true or null if no elements satisfy the predicate.fun firstOrNull(p: (O) -> Boolean ): O? |
flatMap | Maps f over the elements of this chunk and concatenates the result.fun <O2> flatMap(f: (O) -> Chunk <O2>): Chunk <O2> |
fold | Left-folds the elements of this chunk.fun <A> fold(init: A, f: (A, O) -> A): A |
foldLeft | alias for fold fun <A> foldLeft(init: A, f: (A, O) -> A): A |
forEach | Invokes the supplied function for each element of this chunk.fun forEach(f: (O) -> Unit ): Unit |
forEachIndexed | Invokes the supplied function for each element of this chunk.fun forEachIndexed(f: ( Int , O) -> Unit ): Unit |
get | Returns the element at the specified index. Throws if index is < 0 or >= size.abstract operator fun get(i: Int ): O |
hashCode | open fun hashCode(): Int |
indexOfFirst | Returns the index of the first element which passes the specified predicate (i.e., p(i) == true ) or null if no elements pass the predicate.fun indexOfFirst(p: (O) -> Boolean ): Int ? |
isEmpty | True if size is zero, false otherwise.fun isEmpty(): Boolean |
isNotEmpty | False if size is zero, true otherwise.fun isNotEmpty(): Boolean |
iterator | Creates an iterator that iterates the elements of this chunk. The returned iterator is not thread safe.operator fun iterator(): Iterator <O> Creates an iterator that iterates the elements of this chunk starting at index n. The returned iterator is not thread safe. fun iterator(n: Int ): Iterator <O> |
lastOrNull | Gets the last element of this chunk.fun lastOrNull(): O? Returns the last element for which the predicate returns true or null if no elements satisfy the predicate.fun lastOrNull(p: (O) -> Boolean ): O? |
map | Creates a new chunk by applying f to each element in this chunk.fun <A> map(f: (O) -> A): Chunk <A> |
mapAccumulate | Maps the supplied stateful function over each element, outputting the final state and the accumulated outputs. The first invocation of f uses init as the input state value. Each successive invocation uses the output state of the previous invocation.fun <S, O2> mapAccumulate(init: S, f: (S, O) -> Pair <S, O2>): Pair <S, Chunk <O2>> |
mapNotNull | Returns a chunk that has only the elements that satisfy the supplied predicate.fun <B> mapNotNull(p: (O) -> B?): Chunk <B> |
reverseIterator | Creates an iterator that iterates the elements of this chunk in reverse order. The returned iterator is not thread safe.fun reverseIterator(): Iterator <O> |
scan | alias for foldLeft fun <O2> scan(z: O2, f: (O2, O) -> O2): Chunk <O2> |
scanLeft | Like foldLeft but emits each intermediate result of f .fun <O2> scanLeft(z: O2, f: (O2, O) -> O2): Chunk <O2> |
scanLeftCarry | Like scanLeft except the final element is emitted as a standalone value instead of as the last element of the accumulated chunk.fun <O2> scanLeftCarry(z: O2, f: (O2, O) -> O2): Pair < Chunk <O2>, O2> |
size | Returns the number of elements in this chunk.abstract fun size(): Int |
splitAt | Splits this chunk in to two chunks at the specified index.fun splitAt(n: Int ): Pair < Chunk <O>, Chunk <O>> |
splitAtChunk_ | Splits this chunk in to two chunks at the specified index n , which is guaranteed to be in-bounds.abstract fun splitAtChunk_(n: Int ): Pair < Chunk <O>, Chunk <O>> |
tail | fun tail(): Chunk <O> |
take | Takes the first n elements of this chunk.open fun take(n: Int ): Chunk <O> |
takeLast | Takes the last n elements of this chunk.fun takeLast(n: Int ): Chunk <O> |
toArray | open fun toArray(): Array < Any ?> |
toList | Converts this chunk to a list.fun toList(): List <O> |
toString | open fun toString(): String |
zip | Zips this chunk the the supplied chunk, returning a chunk of tuples.fun <O2> zip(that: Chunk <O2>): Chunk < Pair <O, O2>> |
zipWith | Zips this chunk with the supplied chunk, passing each pair to f , resulting in an output chunk.fun <O2, O3> zipWith(that: Chunk <O2>, f: (O, O2) -> O3): Chunk <O3> |
array | Creates a chunk backed by an array.fun <O> array(values: Array <out O>): Chunk <O> |
booleans | Creates a chunk backed by an array of booleans.fun booleans(values: BooleanArray ): Chunk < Boolean > Creates a chunk backed by a subsequence of an array of booleans. fun booleans(values: BooleanArray , offset: Int , length: Int ): Chunk < Boolean > |
boxed | Creates a chunk backed by an array. If O is a primitive type, elements will be boxed.fun <O> boxed(values: Array <O>): Chunk <O> Creates a chunk backed by a subsequence of an array. If A is a primitive type, elements will be boxed.fun <O> boxed(values: Array <O>, offset: Int , length: Int ): Chunk <O> |
bytes | Creates a chunk backed by an array of bytes.fun bytes(values: ByteArray ): Chunk < Byte > Creates a chunk backed by a subsequence of an array of bytes. fun bytes(values: ByteArray , offset: Int , length: Int ): Chunk < Byte > |
concat | Concatenates the specified sequence of chunks in to a single chunk, avoiding boxing.fun <A> concat(chunks: Iterable < Chunk <A>>): Chunk <A> |
doubles | Creates a chunk backed by an array of doubles.fun doubles(values: DoubleArray ): Chunk < Double > Creates a chunk backed by a subsequence of an array of doubles. fun doubles(values: DoubleArray , offset: Int , length: Int ): Chunk < Double > |
empty | Chunk with no elements.fun <O> empty(): Chunk <O> |
floats | Creates a chunk backed by an array of floats.fun floats(values: FloatArray ): Chunk < Float > Creates a chunk backed by a subsequence of an array of floats. fun floats(values: FloatArray , offset: Int , length: Int ): Chunk < Float > |
fromNullable | fun <O> fromNullable(o: O?): Chunk <O> |
ints | Creates a chunk backed by an array of ints.fun ints(values: IntArray ): Chunk < Int > Creates a chunk backed by a subsequence of an array of ints. fun ints(values: IntArray , offset: Int , length: Int ): Chunk < Int > |
invoke | operator fun <O> invoke(size: Int , init: (index: Int ) -> O): Chunk <O> operator fun <O> invoke(vararg oos: O): Chunk <O> |
iterable | fun <O> iterable(l: Iterable <O>): Chunk <O> |
just | Creates a chunk consisting of a single element.fun <O> just(o: O): Chunk <O> |
longs | Creates a chunk backed by an array of longs.fun longs(values: LongArray ): Chunk < Long > Creates a chunk backed by a subsequence of an array of ints. fun longs(values: LongArray , offset: Int , length: Int ): Chunk < Long > |
shorts | Creates a chunk backed by an array of shorts.fun shorts(values: ShortArray ): Chunk < Short > Creates a chunk backed by a subsequence of an array of shorts. fun shorts(values: ShortArray , offset: Int , length: Int ): Chunk < Short > |
copyToArray | fun <O> Chunk <O>.copyToArray(xs: Array <O>, start: Int = 0): Unit fun Chunk < Byte >.copyToArray(xs: ByteArray , start: Int = 0): Unit fun Chunk < Long >.copyToArray(xs: LongArray , start: Int = 0): Unit fun Chunk < Boolean >.copyToArray(xs: BooleanArray , start: Int = 0): Unit fun Chunk < Short >.copyToArray(xs: ShortArray , start: Int = 0): Unit fun Chunk < Int >.copyToArray(xs: IntArray , start: Int = 0): Unit fun Chunk < Float >.copyToArray(xs: FloatArray , start: Int = 0): Unit fun Chunk < Double >.copyToArray(xs: DoubleArray , start: Int = 0): Unit |
intersperse | fun <A> Chunk <A>.intersperse(separator: A): Chunk <A> |
prependTo | Prepends a chunk to the start of this chunk queue.infix fun <A> Chunk <A>.prependTo(q: Queue<A>): Queue<A> Prepends a Chunk onto the front of this stream. infix fun <O> Chunk <O>.prependTo(s: Stream <O>): Stream <O> |
toArray | fun <O> Chunk <O>.toArray(): Array <O> |
Do you like Arrow?
✖