Batch implementation that wraps an array, based on ArrayCursor.
BatchCursor type that works over an underlying Array
.
The Batch
is a BatchCursor factory, similar in spirit
with Scala's Iterable.
The Batch
is a BatchCursor factory, similar in spirit
with Scala's Iterable.
Its cursor() method can be called repeatedly to yield the same sequence.
This class is provided as an alternative to Scala's Iterable because:
recommendedBatchSize
, meaning how many batch can
be processed in a batchesUsed in the Iterant implementation.
Similar to Java's and Scala's Iterator
, the BatchCursor
type can
can be used to iterate over the data in a collection, but it cannot
be used to modify the underlying collection.
Similar to Java's and Scala's Iterator
, the BatchCursor
type can
can be used to iterate over the data in a collection, but it cannot
be used to modify the underlying collection.
Inspired by the standard Iterator
, provides a way to efficiently
apply operations such as map
, filter
, collect
on the underlying
collection without such operations having necessarily lazy behavior.
So in other words, when wrapping a standard Array
, an application of map
will copy the data to a new Array
instance with its elements
modified, immediately and is thus having strict (eager) behavior.
In other cases, when wrapping potentially infinite collections, like
Iterable
or Stream
, that's when lazy behavior happens.
Sample:
def sum(cursor: BatchCursor[Int]): Long = { var sum = 0L while (cursor.hasNext()) { sum += cursor.next() } sum }
This class is provided as an alternative to Scala's Iterator because:
map
, filter
), but only in case the
source cursor doesn't need to be consumed (if the cursor is
backed by an array, then a new array gets created, etc.)recommendedBatchSize
can signal how many batch
can be processed in batchesUsed in the Iterant implementation.
Batch implementation specialized for Boolean
.
Batch implementation specialized for Boolean
.
Under the hood it uses an ArrayBatch
implementation, which is @specialized
. Using BooleansBatch
might be desirable instead for isInstanceOf
checks.
BatchCursor implementation specialized for Boolean
.
BatchCursor implementation specialized for Boolean
.
Under the hood it uses an ArrayCursor
implementation, which is @specialized
. Using BooleansCursor
might be desirable instead for isInstanceOf
checks.
Batch implementation specialized for Byte
.
Batch implementation specialized for Byte
.
Under the hood it uses an ArrayBatch
implementation, which is @specialized
. Using BytesBatch
might be desirable instead for isInstanceOf
checks.
BatchCursor implementation specialized for Byte
.
BatchCursor implementation specialized for Byte
.
Under the hood it uses an ArrayCursor
implementation, which is @specialized
. Using BytesCursor
might
be desirable instead for isInstanceOf
checks.
Batch implementation specialized for Char
.
Batch implementation specialized for Char
.
Under the hood it uses an ArrayBatch
implementation, which is @specialized
. Using CharsBatch
might be desirable instead for isInstanceOf
checks.
BatchCursor implementation specialized for Char
.
BatchCursor implementation specialized for Char
.
Under the hood it uses an ArrayCursor
implementation, which is @specialized
. Using CharsCursor
might
be desirable instead for isInstanceOf
checks.
Batch implementation specialized for Double
.
Batch implementation specialized for Double
.
Under the hood it uses an ArrayBatch
implementation, which is @specialized
. Using DoublesBatch
might be desirable instead for isInstanceOf
checks.
BatchCursor implementation specialized for Double
.
BatchCursor implementation specialized for Double
.
Under the hood it uses an ArrayCursor
implementation, which is @specialized
. Using DoublesCursor
might
be desirable instead for isInstanceOf
checks.
Reusable Batch base class that can be used for implementing generators that simply modify their underlying cursor reference.
Reusable BatchCursor base class that can be used for
implementing cursors by just providing the primitive operations,
hasNext
, next
and recommendedBatchSize
.
Batch implementation specialized for Int
.
Batch implementation specialized for Int
.
Under the hood it uses an ArrayBatch
implementation, which is @specialized
. Using IntegersBatch
might be desirable instead for isInstanceOf
checks.
BatchCursor implementation specialized for Int
.
BatchCursor implementation specialized for Int
.
Under the hood it uses an ArrayCursor
implementation, which is @specialized
. Using IntegersCursor
might
be desirable instead for isInstanceOf
checks.
BatchCursor type that works over an
underlying Iterator
.
BatchCursor type that works over an
underlying Iterator
.
NOTE: all transformations are delegated to the underlying
Iterator
and may thus have lazy behavior.
Batch implementation specialized for Long
.
Batch implementation specialized for Long
.
Under the hood it uses an ArrayBatch
implementation, which is @specialized
. Using LongsBatch
might be desirable instead for isInstanceOf
checks.
BatchCursor implementation specialized for Long
.
BatchCursor implementation specialized for Long
.
Under the hood it uses an ArrayCursor
implementation, which is @specialized
. Using LongsCursor
might
be desirable instead for isInstanceOf
checks.
Batch builders.
BatchCursor builders.
Reusable Batch implementation that's always empty.
BatchCursor implementation that's always empty.
BatchCursor type that works over an underlying
Array
.NOTE: all transformations happen by copying from the source array into a modified copy, hence all transformations have strict behavior!
To build an instance, prefer
BatchCursor.fromArray
.