Package com.tangosol.util
Interface Streamer<T>
-
- All Superinterfaces:
Iterator<T>
- All Known Implementing Classes:
SimpleStreamer
public interface Streamer<T> extends Iterator<T>
Enables traversal of elements in the underlying data set using eitherIterator
,Spliterator
or aStream
, while allowing implementors to provide additional metadata, such as the size and other characteristics of the underlying data set.Similarly to the
Spliterator
, theStreamer
allows only a single traversal of the underlying data set. Moreover, aSpliterator
or aStream
retrieved from a partially consumedStreamer
will continue the traversal of the underlying data.Note, that the
removal
of the underlying elements is not supported.- Since:
- 12.2.1
- Author:
- as 2015.05.06
-
-
Field Summary
Fields Modifier and Type Field 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 fromsize()
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.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
characteristics()
A bit mask representing the set of characteristics of thisStreamer
.default boolean
isAllInclusive()
A convenience accessor to check if this streamer isALL_INCLUSIVE
.default boolean
isSized()
A convenience accessor to check if this streamer isSIZED
.default void
remove()
This operation is not supported.long
size()
Return the exact size of the data set thisStreamer
will iterate over, or negative integer if the exact size is unknown.default Spliterator<T>
spliterator()
Return aSpliterator
over the elements described by thisStreamer
.default Stream<T>
stream()
Return aStream
based on thisStreamer
.-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
-
-
-
Field Detail
-
SIZED
static final int SIZED
Characteristic value signifying that the value returned fromsize()
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.- See Also:
- Constant Field Values
-
ALL_INCLUSIVE
static final int ALL_INCLUSIVE
Characteristic value signifying that this Streamer includes all the values from the underlying data set.- See Also:
- Constant Field Values
-
-
Method Detail
-
size
long size()
Return the exact size of the data set thisStreamer
will iterate over, or negative integer if the exact size is unknown.- Returns:
- the exact size of the data set this
Streamer
will iterate over, or negative integer if the exact size is unknown
-
characteristics
int characteristics()
A bit mask representing the set of characteristics of thisStreamer
.- Returns:
- a bit mask representing the set of characteristics of this
Streamer
-
spliterator
default Spliterator<T> spliterator()
Return aSpliterator
over the elements described by thisStreamer
.- Returns:
- a
Spliterator
over the elements described by thisStreamer
-
stream
default Stream<T> stream()
Return aStream
based on thisStreamer
.- Returns:
- a
Stream
based on thisStreamer
-
isSized
default boolean isSized()
A convenience accessor to check if this streamer isSIZED
.- Returns:
true
if this streamer isSIZED
, false otherwise
-
isAllInclusive
default boolean isAllInclusive()
A convenience accessor to check if this streamer isALL_INCLUSIVE
.- Returns:
true
if this streamer isALL_INCLUSIVE
, false otherwise
-
-