Requests batches until given index
and in case of success returns needed element.
Requests batches until given index
and in case of success returns needed element.
Drops all elements before index not inclusive.
Drops all elements before index not inclusive.
Length of the internal buffer.
Requests batches until index of last retrieved element is less than index
and,
when it's possible, returns true, otherwise false.
Requests batches until index of last retrieved element is less than index
and,
when it's possible, returns true, otherwise false.
Index of the last element which buffer contains.
Also requests batches to the until
.
Also requests batches to the until
.
If the current buffer is too small to provide some part of data after from
bound,
lower bound of slice is cut to the minimum of from
and first index of accessible element in the buffer.
Slice of internal data.
For IndexedSeq
mode it works as regular slice, if until
overshoots the end of input,
it just ignores it and behaves like until
equals to the length of input.
Same for Iterator
mode, but it requests batches while the index of last retrieved element is less than until
and if until
is farther away than any element, it ignores this too.
Contains buffer - queue of elements that extends from given iterator when particular elements are requested; and shrinks by calling
dropBuffer
method.Generally, at any specific time this buffer contains "suffix" of given iterator, e.g. some piece of data from past calls of
next
, which extends by requesting new batches from iterator. Therefore we can denote the same notation of indices as for regularArray
or more abstractIndexedSeq
. The only difference is when index doesn't fit into the bounds of current buffer either the new batches are requested to extend the buffer, either it's inaccessible at all, so calling ofdropBuffer
should guarantee that there won't be any attempts to access to the elements in dropped part of input.