R
- The type of the streampublic interface CacheStream<R> extends Stream<R>, BaseCacheStream<R,Stream<R>>
Stream
that has additional operations to monitor or control behavior when used from a Cache
.
Whenever the iterator or spliterator methods are used the user must close the Stream
that the method was invoked on after completion of its operation. Failure to do so may cause a thread leakage if
the iterator or spliterator are not fully consumed.
When using stream that is backed by a distributed cache these operations will be performed using remote distribution controlled by the segments that each key maps to. All intermediate operations are lazy, even the special cases described in later paragraphs and are not evaluated until a final terminal operation is invoked on the stream. Essentially each set of intermediate operations is shipped to each remote node where they are applied to a local stream there and finally the terminal operation is completed. If this stream is parallel the processing on remote nodes is also done using a parallel stream.
Parallel distribution is enabled by default for all operations except for iterator()
and
spliterator()
. Please see sequentialDistribution()
and
parallelDistribution()
. With this disabled only a single node will process the operation
at a time (includes locally).
Rehash aware is enabled by default for all operations. Any intermediate or terminal operation may be invoked
multiple times during a rehash and thus you should ensure the are idempotent. This can be problematic for
forEach(Consumer)
as it may be difficult to implement with such requirements, please see it for
more information. If you wish to disable rehash aware operations you can disable them by calling
disableRehashAware()
which should provide better performance for some operations. The
performance is most affected for the key aware operations iterator()
,
spliterator()
, forEach(Consumer)
. Disabling rehash can cause
incorrect results if the terminal operation is invoked and a rehash occurs before the operation completes. If
incorrect results do occur it is guaranteed that it will only be that entries were missed and no entries are
duplicated.
Any stateful intermediate operation requires pulling all information up to that point local to operate properly. Each of these methods may have slightly different behavior, so make sure you check the method you are utilizing.
An example of such an operation is using distinct intermediate operation. What will happen
is upon calling the terminal operation a remote retrieval operation will be ran using all of
the intermediate operations up to the distinct operation remotely. This retrieval is then used to fuel a local
stream where all of the remaining intermediate operations are performed and then finally the terminal operation is
applied as normal. Note in this case the intermediate iterator still obeys the
distributedBatchSize(int)
setting irrespective of the terminal operator.
Stream.Builder<T>
BaseCacheStream.SegmentCompletionListener
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(SerializablePredicate<? super R> predicate)
Same as
Stream.allMatch(Predicate) except that the Predicate must also
implement Serializable |
default boolean |
anyMatch(SerializablePredicate<? super R> predicate)
Same as
Stream.anyMatch(Predicate) except that the Predicate must also
implement Serializable |
<R1,A> R1 |
collect(Collector<? super R,A,R1> collector) |
default <R1> R1 |
collect(SerializableSupplier<Collector<? super R,?,R1>> supplier)
Performs a mutable
reduction operation on the elements of this stream using a
Collector that is lazily created from the SerializableSupplier
provided. |
default <R1> R1 |
collect(SerializableSupplier<R1> supplier,
SerializableBiConsumer<R1,? super R> accumulator,
SerializableBiConsumer<R1,R1> combiner)
Same as
Stream.collect(Supplier, BiConsumer, BiConsumer) except that the various arguments must
also implement Serializable |
default <R1> R1 |
collect(Supplier<Collector<? super R,?,R1>> supplier)
Performs a mutable
reduction operation on the elements of this stream using a
Collector that is lazily created from the Supplier
provided. |
CacheStream<R> |
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.
|
CacheStream<R> |
distinct() |
CacheStream<R> |
distributedBatchSize(int batchSize)
Controls how many keys are returned from a remote node when using a stream terminal operation with a distributed
cache to back this stream.
|
CacheStream<R> |
filter(Predicate<? super R> predicate) |
default CacheStream<R> |
filter(SerializablePredicate<? super R> predicate)
Same as
filter(Predicate) except that the Predicate must also
implement Serializable |
CacheStream<R> |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
CacheStream<R> |
filterKeySegments(IntSet segments)
Filters which entries are returned by what segment they are present in.
|
CacheStream<R> |
filterKeySegments(Set<Integer> segments)
Deprecated.
This is to be replaced by
filterKeySegments(IntSet) |
<R1> CacheStream<R1> |
flatMap(Function<? super R,? extends Stream<? extends R1>> mapper) |
default <R1> CacheStream<R1> |
flatMap(SerializableFunction<? super R,? extends Stream<? extends R1>> mapper)
Same as
flatMap(Function) except that the Function must also
implement Serializable |
DoubleCacheStream |
flatMapToDouble(Function<? super R,? extends DoubleStream> mapper) |
default DoubleCacheStream |
flatMapToDouble(SerializableFunction<? super R,? extends DoubleStream> mapper)
Same as
flatMapToDouble(Function) except that the Function must also
implement Serializable |
IntCacheStream |
flatMapToInt(Function<? super R,? extends IntStream> mapper) |
default IntCacheStream |
flatMapToInt(SerializableFunction<? super R,? extends IntStream> mapper)
Same as
flatMapToInt(Function) except that the Function must also
implement Serializable |
LongCacheStream |
flatMapToLong(Function<? super R,? extends LongStream> mapper) |
default LongCacheStream |
flatMapToLong(SerializableFunction<? super R,? extends LongStream> mapper)
Same as
flatMapToLong(Function) except that the Function must also
implement Serializable |
<K,V> void |
forEach(BiConsumer<Cache<K,V>,? super R> action)
Same as
forEach(Consumer) except that it takes a BiConsumer that provides access
to the underlying Cache that is backing this stream. |
void |
forEach(Consumer<? super R> action) |
default <K,V> void |
forEach(SerializableBiConsumer<Cache<K,V>,? super R> action)
|
default void |
forEach(SerializableConsumer<? super R> action)
Same as
forEach(Consumer) except that the Consumer must also
implement Serializable |
Iterator<R> |
iterator() |
CacheStream<R> |
limit(long maxSize) |
<R1> CacheStream<R1> |
map(Function<? super R,? extends R1> mapper) |
default <R1> CacheStream<R1> |
map(SerializableFunction<? super R,? extends R1> mapper)
Same as
map(Function) except that the Function must also
implement Serializable |
default DoubleCacheStream |
mapToDouble(SerializableToDoubleFunction<? super R> mapper)
Same as
mapToDouble(ToDoubleFunction) except that the ToDoubleFunction must also
implement Serializable |
DoubleCacheStream |
mapToDouble(ToDoubleFunction<? super R> mapper) |
default IntCacheStream |
mapToInt(SerializableToIntFunction<? super R> mapper)
Same as
mapToInt(ToIntFunction) except that the ToIntFunction must also
implement Serializable |
IntCacheStream |
mapToInt(ToIntFunction<? super R> mapper) |
default LongCacheStream |
mapToLong(SerializableToLongFunction<? super R> mapper)
Same as
mapToLong(ToLongFunction) except that the ToLongFunction must also
implement Serializable |
LongCacheStream |
mapToLong(ToLongFunction<? super R> mapper) |
default Optional<R> |
max(SerializableComparator<? super R> comparator)
Same as
Stream.max(Comparator) except that the Comparator must also
implement Serializable |
default Optional<R> |
min(SerializableComparator<? super R> comparator)
Same as
Stream.min(Comparator) except that the Comparator must also
implement Serializable |
default boolean |
noneMatch(SerializablePredicate<? super R> predicate)
Same as
Stream.noneMatch(Predicate) except that the Predicate must also
implement Serializable |
CacheStream<R> |
onClose(Runnable closeHandler) |
CacheStream<R> |
parallel() |
CacheStream<R> |
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.
|
CacheStream<R> |
peek(Consumer<? super R> action) |
default CacheStream<R> |
peek(SerializableConsumer<? super R> action)
Same as
peek(Consumer) except that the Consumer must also implement Serializable |
default R |
reduce(R identity,
SerializableBinaryOperator<R> accumulator)
Same as
Stream.reduce(Object, BinaryOperator) except that the BinaryOperator must also
implement Serializable |
default Optional<R> |
reduce(SerializableBinaryOperator<R> accumulator)
Same as
Stream.reduce(BinaryOperator) except that the BinaryOperator must also
implement Serializable |
default <U> U |
reduce(U identity,
SerializableBiFunction<U,? super R,U> accumulator,
SerializableBinaryOperator<U> combiner)
Same as
Stream.reduce(Object, BiFunction, BinaryOperator) except that the BinaryOperator must also
implement Serializable |
CacheStream<R> |
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed
processing.
|
CacheStream<R> |
sequential() |
CacheStream<R> |
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.
|
CacheStream<R> |
skip(long n) |
CacheStream<R> |
sorted() |
CacheStream<R> |
sorted(Comparator<? super R> comparator) |
default CacheStream<R> |
sorted(SerializableComparator<? super R> comparator)
Same as
sorted(Comparator) except that the Comparator must
also implement Serializable |
Spliterator<R> |
spliterator() |
CacheStream<R> |
timeout(long timeout,
TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.
|
default <A> A[] |
toArray(SerializableIntFunction<A[]> generator)
Same as
Stream.toArray(IntFunction) except that the BinaryOperator must also
implement Serializable |
CacheStream<R> |
unordered() |
allMatch, anyMatch, builder, collect, concat, count, empty, findAny, findFirst, forEachOrdered, generate, iterate, max, min, noneMatch, of, of, reduce, reduce, reduce, toArray, toArray
close, isParallel
CacheStream<R> sequentialDistribution()
Parallel distribution is enabled by default except for iterator()
and
spliterator()
sequentialDistribution
in interface BaseCacheStream<R,Stream<R>>
CacheStream<R> parallelDistribution()
BaseCacheStream
Parallel distribution is enabled by default except for iterator()
and
spliterator()
parallelDistribution
in interface BaseCacheStream<R,Stream<R>>
CacheStream<R> filterKeySegments(Set<Integer> segments)
filterKeySegments(IntSet)
filter(Predicate)
method as this can control what nodes are
asked for data and what entries are read from the underlying CacheStore if present.filterKeySegments
in interface BaseCacheStream<R,Stream<R>>
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.CacheStream<R> filterKeySegments(IntSet segments)
filter(Predicate)
method as this can control what nodes are
asked for data and what entries are read from the underlying CacheStore if present.filterKeySegments
in interface BaseCacheStream<R,Stream<R>>
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.CacheStream<R> filterKeys(Set<?> keys)
filter(Predicate)
if the filter is holding references to the same
keys.filterKeys
in interface BaseCacheStream<R,Stream<R>>
keys
- The keys that this stream will only operate on.CacheStream<R> distributedBatchSize(int batchSize)
iterator()
, spliterator()
,
forEach(Consumer)
. Please see those methods for additional information on how this value
may affect them.
This value may be used in the case of a a terminal operator that doesn't track keys if an intermediate
operation is performed that requires bringing keys locally to do computations. Examples of such intermediate
operations are sorted()
, sorted(Comparator)
,
distinct()
, limit(long)
, skip(long)
This value is always ignored when this stream is backed by a cache that is not distributed as all values are already local.
distributedBatchSize
in interface BaseCacheStream<R,Stream<R>>
batchSize
- The size of each batch. This defaults to the state transfer chunk size.CacheStream<R> segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
This method is designed for the sole purpose of use with the iterator()
to allow for
a user to track completion of segments as they are returned from the iterator. Behavior of other methods
is not specified. Please see iterator()
for more information.
Multiple listeners may be registered upon multiple invocations of this method. The ordering of notified listeners is not specified.
This is only used if this stream did not invoke BaseCacheStream.disableRehashAware()
and has no
flat map based operations. If this is done no segments will be notified.
segmentCompletionListener
in interface BaseCacheStream<R,Stream<R>>
listener
- The listener that will be called back as segments are completed.CacheStream<R> disableRehashAware()
Most terminal operations will run faster with rehash awareness disabled even without a rehash occuring. However if a rehash occurs with this disabled be prepared to possibly receive only a subset of values.
disableRehashAware
in interface BaseCacheStream<R,Stream<R>>
CacheStream<R> timeout(long timeout, TimeUnit unit)
If a timeout does occur then a TimeoutException
is thrown from the terminal
operation invoking thread or on the next call to the Iterator
or Spliterator
.
Note that if a rehash occurs this timeout value is reset for the subsequent retry if rehash aware is enabled.
timeout
in interface BaseCacheStream<R,Stream<R>>
timeout
- the maximum time to waitunit
- the time unit of the timeout argumentvoid forEach(Consumer<? super R> action)
This operation is performed remotely on the node that is the primary owner for the key tied to the entry(s) in this stream.
NOTE: This method while being rehash aware has the lowest consistency of all of the operators. This
operation will be performed on every entry at least once in the cluster, as long as the originator doesn't go
down while it is being performed. This is due to how the distributed action is performed. Essentially the
distributedBatchSize(int)
value controls how many elements are processed per node at a time
when rehash is enabled. After those are complete the keys are sent to the originator to confirm that those were
processed. If that node goes down during/before the response those keys will be processed a second time.
It is possible to have the cache local to each node injected into this instance if the provided
Consumer also implements the CacheAware
interface. This method will be invoked
before the consumer accept()
method is invoked.
This method is ran distributed by default with a distributed backing cache. However if you wish for this
operation to run locally you can use the stream().iterator().forEachRemaining(action)
for a single
threaded variant. If you
wish to have a parallel variant you can use StreamSupport.stream(Spliterator, boolean)
passing in the spliterator from the stream. In either case remember you must close the stream after
you are done processing the iterator or spliterator..
default void forEach(SerializableConsumer<? super R> action)
forEach(Consumer)
except that the Consumer must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
action
- consumer to be ran for each element in the stream<K,V> void forEach(BiConsumer<Cache<K,V>,? super R> action)
forEach(Consumer)
except that it takes a BiConsumer
that provides access
to the underlying Cache
that is backing this stream.
Note that the CacheAware
interface is not supported for injection using this method as the cache
is provided in the consumer directly.
K
- key type of the cacheV
- value type of the cacheaction
- consumer to be ran for each element in the streamdefault <K,V> void forEach(SerializableBiConsumer<Cache<K,V>,? super R> action)
K
- key type of the cacheV
- value type of the cacheaction
- consumer to be ran for each element in the streamIterator<R> iterator()
Usage of this operator requires closing this stream after you are done with the iterator. The preferred usage is to use a try with resource block on the stream.
This method has special usage with the org.infinispan.CacheStream.SegmentCompletionListener
in
that as entries are retrieved from the next method it will complete segments.
This method obeys the distributedBatchSize(int)
. Note that when using methods such as
flatMap(Function)
that you will have possibly more than 1 element mapped to a given key
so this doesn't guarantee that many number of entries are returned per batch.
Note that the Iterator.remove()
method is only supported if no intermediate operations have been
applied to the stream and this is not a stream created from a Cache.values()
collection.
iterator
in interface BaseStream<R,Stream<R>>
Spliterator<R> spliterator()
Usage of this operator requires closing this stream after you are done with the spliterator. The preferred usage is to use a try with resource block on the stream.
spliterator
in interface BaseStream<R,Stream<R>>
CacheStream<R> sorted()
This operation is performed entirely on the local node irrespective of the backing cache. This
operation will act as an intermediate iterator operation requiring data be brought locally for proper behavior.
Beware this means it will require having all entries of this cache into memory at one time. This is described in
more detail at CacheStream
Any subsequent intermediate operations and the terminal operation are also performed locally.
CacheStream<R> sorted(Comparator<? super R> comparator)
This operation is performed entirely on the local node irrespective of the backing cache. This
operation will act as an intermediate iterator operation requiring data be brought locally for proper behavior.
Beware this means it will require having all entries of this cache into memory at one time. This is described in
more detail at CacheStream
Any subsequent intermediate operations and the terminal operation are then performed locally.
default CacheStream<R> sorted(SerializableComparator<? super R> comparator)
sorted(Comparator)
except that the Comparator must
also implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
comparator
- a non-interfering, stateless
Comparator
to be used to compare stream elementsCacheStream<R> limit(long maxSize)
This intermediate operation will be performed both remotely and locally to reduce how many elements are sent back from each node. More specifically this operation is applied remotely on each node to only return up to the maxSize value and then the aggregated results are limited once again on the local node.
This operation will act as an intermediate iterator operation requiring data be brought locally for proper
behavior. This is described in more detail in the CacheStream
documentation
Any subsequent intermediate operations and the terminal operation are then performed locally.
CacheStream<R> skip(long n)
This operation is performed entirely on the local node irrespective of the backing cache. This
operation will act as an intermediate iterator operation requiring data be brought locally for proper behavior.
This is described in more detail in the CacheStream
documentation
Depending on the terminal operator this may or may not require all entries or a subset after skip is applied to be in memory all at once.
Any subsequent intermediate operations and the terminal operation are then performed locally.
CacheStream<R> peek(Consumer<? super R> action)
default CacheStream<R> peek(SerializableConsumer<? super R> action)
peek(Consumer)
except that the Consumer must also implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
action
- a non-interfering action to perform on the elements as
they are consumed from the streamCacheStream<R> distinct()
This operation will be invoked both remotely and locally when used with a distributed cache backing this stream.
This operation will act as an intermediate iterator operation requiring data be brought locally for proper
behavior. This is described in more detail in the CacheStream
documentation
This intermediate iterator operation will be performed locally and remotely requiring possibly a subset of all elements to be in memory
Any subsequent intermediate operations and the terminal operation are then performed locally.
<R1,A> R1 collect(Collector<? super R,A,R1> collector)
Note when using a distributed backing cache for this stream the collector must be marshallable. This
prevents the usage of Collectors
class. However you can use the
CacheCollectors
static factory methods to create a serializable wrapper, which then
creates the actual collector lazily after being deserialized. This is useful to use any method from the
Collectors
class as you would normally.
Alternatively, you can call collect(SerializableSupplier)
too.
collect
in interface Stream<R>
R1
- collected typeA
- intermediate collected type if applicablecollector
- CacheCollectors
default <R1> R1 collect(SerializableSupplier<Collector<? super R,?,R1>> supplier)
Collector
that is lazily created from the SerializableSupplier
provided.
This method behaves exactly the same as collect(Collector)
with
the enhanced capability of working even when the mutable reduction
operation has to run in a remote node and the operation is not
Serializable
or otherwise marshallable.
So, this method is specially designed for situations when the user
wants to use a Collector
instance that has been created by
Collectors
static factory methods.
In this particular case, the function that instantiates the
Collector
will be marshalled according to the
Serializable
rules.R1
- The resulting type of the collectorsupplier
- The supplier to create the collector that is specifically serializabledefault <R1> R1 collect(Supplier<Collector<? super R,?,R1>> supplier)
Collector
that is lazily created from the Supplier
provided.
This method behaves exactly the same as collect(Collector)
with
the enhanced capability of working even when the mutable reduction
operation has to run in a remote node and the operation is not
Serializable
or otherwise marshallable.
So, this method is specially designed for situations when the user
wants to use a Collector
instance that has been created by
Collectors
static factory methods.
In this particular case, the function that instantiates the
Collector
will be marshalled using Infinispan
Externalizer
class or one of its
subtypes.R1
- The resulting type of the collectorsupplier
- The supplier to create the collectordefault <R1> R1 collect(SerializableSupplier<R1> supplier, SerializableBiConsumer<R1,? super R> accumulator, SerializableBiConsumer<R1,R1> combiner)
Stream.collect(Supplier, BiConsumer, BiConsumer)
except that the various arguments must
also implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
R1
- type of the resultsupplier
- a function that creates a new result container. For a
parallel execution, this function may be called
multiple times and must return a fresh value each time.
Must be serializableaccumulator
- an associative, non-interfering, stateless
function for incorporating an additional element into a result and
must be serializablecombiner
- an associative, non-interfering, stateless
function for combining two values, which must be
compatible with the accumulator function and serializabledefault boolean allMatch(SerializablePredicate<? super R> predicate)
Stream.allMatch(Predicate)
except that the Predicate must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
predicate
- a non-interfering, stateless
predicate to apply to elements of this stream that is serializabletrue
if either all elements of the stream match the
provided predicate or the stream is empty, otherwise false
default boolean noneMatch(SerializablePredicate<? super R> predicate)
Stream.noneMatch(Predicate)
except that the Predicate must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
predicate
- a non-interfering, stateless
predicate to apply to elements of this stream that is serializabletrue
if either no elements of the stream match the
provided predicate or the stream is empty, otherwise false
default boolean anyMatch(SerializablePredicate<? super R> predicate)
Stream.anyMatch(Predicate)
except that the Predicate must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
predicate
- a non-interfering, stateless
predicate to apply to elements of this stream that is serializabletrue
if any elements of the stream match the provided
predicate, otherwise false
default Optional<R> max(SerializableComparator<? super R> comparator)
Stream.max(Comparator)
except that the Comparator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
comparator
- a non-interfering, stateless
Comparator
to compare elements of this stream that is also serializableOptional
describing the maximum element of this stream,
or an empty Optional
if the stream is emptydefault Optional<R> min(SerializableComparator<? super R> comparator)
Stream.min(Comparator)
except that the Comparator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
comparator
- a non-interfering, stateless
Comparator
to compare elements of this stream that is also serializableOptional
describing the minimum element of this stream,
or an empty Optional
if the stream is emptydefault Optional<R> reduce(SerializableBinaryOperator<R> accumulator)
Stream.reduce(BinaryOperator)
except that the BinaryOperator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
accumulator
- an associative, non-interfering, stateless
function for combining two values that is also serializableOptional
describing the result of the reductiondefault R reduce(R identity, SerializableBinaryOperator<R> accumulator)
Stream.reduce(Object, BinaryOperator)
except that the BinaryOperator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
identity
- the identity value for the accumulating functionaccumulator
- an associative, non-interfering, stateless
function for combining two values that is also serializabledefault <U> U reduce(U identity, SerializableBiFunction<U,? super R,U> accumulator, SerializableBinaryOperator<U> combiner)
Stream.reduce(Object, BiFunction, BinaryOperator)
except that the BinaryOperator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
U
- The type of the resultidentity
- the identity value for the combiner functionaccumulator
- an associative, non-interfering, stateless
function for incorporating an additional element into a result that is also serializablecombiner
- an associative, non-interfering, stateless
function for combining two values, which must be
compatible with the accumulator function that is also serializabledefault <A> A[] toArray(SerializableIntFunction<A[]> generator)
Stream.toArray(IntFunction)
except that the BinaryOperator must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
A
- the element type of the resulting arraygenerator
- a function which produces a new array of the desired
type and the provided length that is also serializableCacheStream<R> filter(Predicate<? super R> predicate)
default CacheStream<R> filter(SerializablePredicate<? super R> predicate)
filter(Predicate)
except that the Predicate must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
predicate
- a non-interfering, stateless
predicate to apply to each element to determine if it
should be included<R1> CacheStream<R1> map(Function<? super R,? extends R1> mapper)
default <R1> CacheStream<R1> map(SerializableFunction<? super R,? extends R1> mapper)
map(Function)
except that the Function must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
R1
- The element type of the new streammapper
- a non-interfering, stateless
function to apply to each elementDoubleCacheStream mapToDouble(ToDoubleFunction<? super R> mapper)
mapToDouble
in interface Stream<R>
mapper
- a non-interfering, stateless
function to apply to each elementdefault DoubleCacheStream mapToDouble(SerializableToDoubleFunction<? super R> mapper)
mapToDouble(ToDoubleFunction)
except that the ToDoubleFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapper
- a non-interfering, stateless
function to apply to each elementIntCacheStream mapToInt(ToIntFunction<? super R> mapper)
default IntCacheStream mapToInt(SerializableToIntFunction<? super R> mapper)
mapToInt(ToIntFunction)
except that the ToIntFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapper
- a non-interfering, stateless
function to apply to each elementLongCacheStream mapToLong(ToLongFunction<? super R> mapper)
default LongCacheStream mapToLong(SerializableToLongFunction<? super R> mapper)
mapToLong(ToLongFunction)
except that the ToLongFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapper
- a non-interfering, stateless
function to apply to each element<R1> CacheStream<R1> flatMap(Function<? super R,? extends Stream<? extends R1>> mapper)
default <R1> CacheStream<R1> flatMap(SerializableFunction<? super R,? extends Stream<? extends R1>> mapper)
flatMap(Function)
except that the Function must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
R1
- The element type of the new streammapper
- a non-interfering, stateless
function to apply to each element which produces a stream
of new valuesDoubleCacheStream flatMapToDouble(Function<? super R,? extends DoubleStream> mapper)
flatMapToDouble
in interface Stream<R>
default DoubleCacheStream flatMapToDouble(SerializableFunction<? super R,? extends DoubleStream> mapper)
flatMapToDouble(Function)
except that the Function must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapper
- a non-interfering, stateless
function to apply to each element which produces a stream
of new valuesIntCacheStream flatMapToInt(Function<? super R,? extends IntStream> mapper)
flatMapToInt
in interface Stream<R>
default IntCacheStream flatMapToInt(SerializableFunction<? super R,? extends IntStream> mapper)
flatMapToInt(Function)
except that the Function must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapper
- a non-interfering, stateless
function to apply to each element which produces a stream
of new valuesLongCacheStream flatMapToLong(Function<? super R,? extends LongStream> mapper)
flatMapToLong
in interface Stream<R>
default LongCacheStream flatMapToLong(SerializableFunction<? super R,? extends LongStream> mapper)
flatMapToLong(Function)
except that the Function must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
mapper
- a non-interfering, stateless
function to apply to each element which produces a stream
of new valuesCacheStream<R> parallel()
parallel
in interface BaseStream<R,Stream<R>>
CacheStream<R> sequential()
sequential
in interface BaseStream<R,Stream<R>>
CacheStream<R> unordered()
unordered
in interface BaseStream<R,Stream<R>>
CacheStream<R> onClose(Runnable closeHandler)
onClose
in interface BaseStream<R,Stream<R>>
closeHandler
- Copyright © 2021 JBoss by Red Hat. All rights reserved.