|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
E
- the type of elements in the streamS
- the type of the backing storepublic interface GettableStream<E,S extends ReadOnlySequence<E>>
Provides protocol for a stream that can read objects from its future sequence values.
Method Summary | ||
---|---|---|
|
forEachDo(UnaryFunctor<? super E,? extends R> operation)
Evaluates the given operation with each of this stream's future sequence values, terminating evaluation when there are no more future sequence values. |
|
boolean |
isNextMatchFor(E target)
Reads the next object from this stream and tells whether the object is equivalent to the given target. |
|
boolean |
isPeekMatchFor(E target)
Peeks at the next object in this stream and tells whether it is equivalent to the given target. |
|
E |
next()
Answers the next object in this stream. |
|
S |
next(int amount)
Answers a collection of the next given number of objects in this stream. |
|
E |
peek()
Answers the next object in this stream without advancing this stream's position. |
|
void |
skip(int amount)
Skips the next given number of objects in this stream's future sequence values. |
|
boolean |
skipTo(E target)
Sets this stream to read the object just after the next occurrence of the given target and answers true . |
|
S |
upTo(E target)
Answers a collection of all of the objects in this stream up to, but not including, the next occurrence of the given target. |
Method Detail |
---|
<R> void forEachDo(UnaryFunctor<? super E,? extends R> operation)
operation
. The number of evaluations is
equal to the initial size of the future sequence values. If initially there are
no future sequence values, operation
is not evaluated. The future
sequence values are used as arguments in their sequence order. The result is
undefined if any evaluation of operation
changes the future sequence
values.
R
- a constraint on the return type of the operationoperation
- the operation to evaluate
NullPointerException
- if operation
is null
E next()
NoSuchElementException
- if this stream has no future sequence
valuesS next(int amount)
amount
are removed from the future sequence
values and appended, in order, to the end of the past sequence values.
A collection whose elements consist of those objects, in the same order,
is returned. If amount == 0
, an empty collection is returned.
amount
- the number of objects to enumerate
IllegalArgumentException
- if amount < 0
or amount >
the
number of objects in this stream's future sequence valuesboolean isNextMatchFor(E target)
target
.
target
- the object against which to compare the next object from this
stream
true
if the next object is equivalent to target
;
false
otherwise
NoSuchElementException
- if there are no future sequence values
in this streamE peek()
null
if this stream has no future
sequence values. The answer will also be null
if the first future
sequence value is null
.
boolean isPeekMatchFor(E target)
target
- the object to match against
true
if the first object in this stream's future sequence values
is equivalent to target
, otherwise false
void skip(int amount)
amount
and the size of the
future sequence values are removed from the future sequence values and appended,
in order, to the end of the past sequence values.
amount
- the number of objects to skip
IllegalArgumentException
- if amount < 0
boolean skipTo(E target)
true
. If target
is not found before the end
of this stream is encountered, answers false
.
Each object in the future sequence values up to and including the first
occurrence of an object that is equivalent to
target
is removed from the future sequence values and appended to the
past sequence values. If an object that is equivalent to target
is not
found in the future sequence values, all of the objects in the future sequence
values are so appended.
target
- the object to skip to
true
if target
could be found, otherwise false
S upTo(E target)
target
. If target
is
not found and the end of this stream is encountered, a collection of the objects
read is returned.
Each object in the future sequence values up to and including the first
occurrence of an object that is equivalent
to target
is removed from the future sequence values and appended to the
past sequence values. A collection, containing, in order, all of the transferred
objects except the object (if any) that is equivalent to target
is returned. If the future sequence values is initially empty, an empty
collection is returned.
target
- the object to seek
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |