Chunk
Strict, finite sequence of values that allows index-based random access of elements.
Chunks can be created from a variety of collection types using methods on the Chunk companion(e.g.,
Chunk.vector, Chunk.seq, Chunk.array). Additionally, the Chunk companiondefines a subtype of
Chunk for each primitive type, using an unboxed primitive array.To work with unboxed arrays, use methods like
toBytes to convert a Chunk[Byte] to a Chunk.Bytesand then access the array directly.
The operations on
intermediate chunks being created (1 per call to
Chunk are all defined strictly. For example, c.map(f).map(g).map(h) results inintermediate chunks being created (1 per call to
map).- Companion
- object
class Booleans
class Bytes
class ShortBuffer
class LongBuffer
class DoubleBuffer
class FloatBuffer
class IntBuffer
class CharBuffer
class ByteBuffer
class Shorts
class Ints
class Longs
class Floats
class Doubles
class Chars
class ByteVectorChunk
Value members
Methods
Returns the first element for which the predicate returns true or
None if no elements satisfy the predicate.Creates an iterator that iterates the elements of this chunk. The returned iterator is not thread safe.
Returns the index of the first element which passes the specified predicate (i.e.,
or
p(i) == true)or
None if no elements pass the predicate.Maps the supplied stateful function over each element, outputting the final state and the accumulated outputs.
The first invocation of
the output state of the previous invocation.
The first invocation of
f uses init as the input state value. Each successive invocation usesthe output state of the previous invocation.
Creates an iterator that iterates the elements of this chunk in reverse order. The returned iterator is not thread safe.
Like
the last element of the accumulated chunk.
scanLeft except the final element is emitted as a standalone value instead of asthe last element of the accumulated chunk.
Equivalent to
val b = a.scanLeft(z)(f); val (c, carry) = b.splitAt(b.size - 1).Converts this chunk to a
If this chunk is already backed by an unboxed array of booleans, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Booleans, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of booleans, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Converts this chunk to a
If this chunk is already backed by an unboxed array of bytes, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Bytes, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of bytes, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Converts this chunk to a
If this chunk is already backed by an unboxed array of bytes, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Shorts, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of bytes, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Converts this chunk to a
If this chunk is already backed by an unboxed array of bytes, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Ints, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of bytes, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Converts this chunk to a
If this chunk is already backed by an unboxed array of longs, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Longs, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of longs, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Converts this chunk to a
If this chunk is already backed by an unboxed array of doubles, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Floats, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of doubles, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Converts this chunk to a
If this chunk is already backed by an unboxed array of doubles, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Chunk.Doubles, allowing access to the underlying array of elements.If this chunk is already backed by an unboxed array of doubles, this method runs in constant time.
Otherwise, this method will copy of the elements of this chunk in to a single array.
Returns true if this chunk is known to have elements of type
This is determined by checking if the chunk type mixes in
B.This is determined by checking if the chunk type mixes in
Chunk.KnownElementType.