Creates a cursor by transforming values produced by the source cursor with a partial function, dropping those values for which the partial function is not defined.
Creates a cursor by transforming values produced by the source cursor with a partial function, dropping those values for which the partial function is not defined.
NOTE: application of this function can be either strict or lazy (depending on the underlying cursor type), but it does not modify the original collection.
the partial function which filters and maps the cursor.
a new cursor which yields each value x
produced by this
cursor for which pf
is defined
Creates a new cursor that advances this cursor past the
first n
elements, or the length of the cursor,
whichever is smaller.
Creates a new cursor that advances this cursor past the
first n
elements, or the length of the cursor,
whichever is smaller.
the number of elements to drop
a cursor which produces all values of the current cursor,
except it omits the first n
values.
Returns an cursor over all the elements of the source cursor
that satisfy the predicate p
.
Returns an cursor over all the elements of the source cursor
that satisfy the predicate p
. The order of the elements
is preserved.
NOTE: application of this function can be either strict or lazy (depending on the underlying cursor type), but it does not modify the original collection.
the predicate used to test values.
a cursor which produces those values of this cursor
which satisfy the predicate p
.
Applies a binary operator to a start value and all elements of this cursor, going left to right.
Applies a binary operator to a start value and all elements of this cursor, going left to right.
NOTE: applying this function on the cursor will consume it completely.
is the result type of the binary operator.
is the start value.
the binary operator to apply
the result of inserting op
between consecutive elements
of this cursor, going left to right with the start value
initial
on the left. Returns initial
if the cursor
is empty.
Tests whether this cursor can provide another element.
Tests whether this cursor can provide another element.
This method can be side-effecting, depending on the implementation and thus it can also throw exceptions. This is because in certain cases the only way to know if there is a next element or not involves triggering dangerous side-effects.
This method is idempotent until the call to next
happens, meaning that multiple hasNext
calls can be
made and implementations are advised to memoize the
result.
true
if a subsequent call to next will yield
an element, false
otherwise.
Returns true
in case our cursor is empty or false
if there
are more elements to process.
Returns true
in case our cursor is empty or false
if there
are more elements to process.
Alias for !cursor.hasNext()
.
Creates a new cursor that maps all produced values of this cursor to new values using a transformation function.
Creates a new cursor that maps all produced values of this cursor to new values using a transformation function.
NOTE: application of this function can be either strict or lazy (depending on the underlying cursor type), but it does not modify the original collection.
is the transformation function
a new cursor which transforms every value produced by this
cursor by applying the function f
to it.
Produces the next element of this iterator.
Produces the next element of this iterator.
This method is side-effecting, as it mutates the internal state of the cursor and can throw exceptions.
the next element of this iterator, if hasNext
is true
,
undefined behavior otherwise (can throw exceptions).
Returns true
in case our cursor has more elements
to process or false
if the cursor is empty.
Returns true
in case our cursor has more elements
to process or false
if the cursor is empty.
Alias for hasNext.
In case this cursor is going to be processed eagerly, in batches then this value should be the recommended batch size for the source cursor.
In case this cursor is going to be processed eagerly, in batches then this value should be the recommended batch size for the source cursor.
Examples:
1024
Iterator.range
), it could be 128.1
.Basically the batch size should be adjusted according to how expensive processing this cursor is. If it's a strict collection of a finite size, then it can probably be processed all at once. But if it's a big database result set that can block threads on reads, then it's probably wise to do it one item at a time.
Creates an cursor returning an interval of the values produced by this cursor.
Creates an cursor returning an interval of the values produced by this cursor.
the index of the first element in this cursor which forms part of the slice.
the index of the first element following the slice.
a cursor which advances this cursor past
the first from
elements using drop
,
and then takes until - from
elements,
using take
Creates a new cursor that will only emit the
first n
values of this cursor.
Creates a new cursor that will only emit the
first n
values of this cursor.
is the number of values to take
a cursor producing only of the first n
values of
this cursor, or else the whole sequence,
if it produces fewer than n
values.
Converts this cursor into an Array
,
consuming it in the process.
Converts this cursor into an Array
,
consuming it in the process.
Converts this cursor into a reusable array-backed Batch, consuming it in the process.
Converts this cursor into a reusable array-backed Batch, consuming it in the process.
Converts this cursor into a Scala Iterator
.
Converts this cursor into a Scala Iterator
.
Converts this cursor into a Scala immutable List
,
consuming it in the process.
Converts this cursor into a Scala immutable List
,
consuming it in the process.
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
.