public interface Streamer<T> extends Iterator<T>
Iterator, Spliterator or a Stream, while allowing
implementors to provide additional metadata, such as the size and other
characteristics of the underlying data set.
Similarly to the Spliterator, the Streamer allows only a
single traversal of the underlying data set. Moreover, a Spliterator or a Stream retrieved from a partially
consumed Streamer will continue the traversal of the underlying data.
Note, that the removal of the underlying elements is not supported.
| Modifier and Type | Field and Description |
|---|---|
static int |
ALL_INCLUSIVE
Characteristic value signifying that this Streamer includes all the
values from the underlying data set.
|
static int |
SIZED
Characteristic value signifying that the value returned from
size() prior to traversal represents a finite size that,
in the absence of structural source modification, represents an exact
count of the number of elements that would be encountered by a complete
traversal. |
| Modifier and Type | Method and Description |
|---|---|
int |
characteristics()
A bit mask representing the set of characteristics of this
Streamer. |
default boolean |
isAllInclusive()
A convenience accessor to check if this streamer is
ALL_INCLUSIVE. |
default boolean |
isSized()
A convenience accessor to check if this streamer is
SIZED. |
default void |
remove()
This operation is not supported.
|
long |
size()
Return the exact size of the data set this
Streamer will iterate over,
or negative integer if the exact size is unknown. |
default Spliterator<T> |
spliterator()
Return a
Spliterator over the elements described by this Streamer. |
default Stream<T> |
stream()
Return a
Stream based on this Streamer. |
forEachRemaining, hasNext, nextstatic final int SIZED
size() prior to traversal represents a finite size that,
in the absence of structural source modification, represents an exact
count of the number of elements that would be encountered by a complete
traversal.static final int ALL_INCLUSIVE
long size()
Streamer will iterate over,
or negative integer if the exact size is unknown.Streamer will iterate over,
or negative integer if the exact size is unknownint characteristics()
Streamer.Streamerdefault Spliterator<T> spliterator()
Spliterator over the elements described by this Streamer.Spliterator over the elements described by this
Streamerdefault Stream<T> stream()
Stream based on this Streamer.Stream based on this Streamerdefault boolean isSized()
SIZED.true if this streamer is SIZED, false otherwisedefault boolean isAllInclusive()
ALL_INCLUSIVE.true if this streamer is ALL_INCLUSIVE, false otherwise