public interface DoubleCacheStream extends DoubleStream, BaseCacheStream<Double,DoubleStream>
DoubleStream
that has additional methods to allow for Serializable instances. Please see
CacheStream
for additional details about various methods.DoubleStream.Builder
BaseCacheStream.SegmentCompletionListener
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(SerializableDoublePredicate predicate)
Same as
DoubleStream.allMatch(DoublePredicate) except that the DoublePredicate must
also implement Serializable |
default boolean |
anyMatch(SerializableDoublePredicate predicate)
Same as
DoubleStream.anyMatch(DoublePredicate) except that the DoublePredicate must
also implement Serializable |
CacheStream<Double> |
boxed() |
default <R> R |
collect(SerializableSupplier<R> supplier,
SerializableObjDoubleConsumer<R> accumulator,
SerializableBiConsumer<R,R> combiner)
Same as
DoubleStream.collect(Supplier, ObjDoubleConsumer, BiConsumer) except that the arguments must
also implement Serializable |
DoubleCacheStream |
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.
|
DoubleCacheStream |
distinct() |
DoubleCacheStream |
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.
|
DoubleCacheStream |
filter(DoublePredicate predicate) |
default DoubleCacheStream |
filter(SerializableDoublePredicate predicate)
Same as
filter(DoublePredicate) except that the DoublePredicate must also
implement Serializable |
DoubleCacheStream |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
DoubleCacheStream |
filterKeySegments(Set<Integer> segments)
Filters which entries are returned by what segment they are present in.
|
DoubleCacheStream |
flatMap(DoubleFunction<? extends DoubleStream> mapper) |
default DoubleCacheStream |
flatMap(SerializableDoubleFunction<? extends DoubleStream> mapper)
Same as
flatMap(DoubleFunction) except that the DoubleFunction must also
implement Serializable |
<K,V> void |
forEach(ObjDoubleConsumer<Cache<K,V>> action)
Same as
DoubleStream.forEach(DoubleConsumer) except that it takes an ObjDoubleConsumer that
provides access to the underlying Cache that is backing this stream. |
default void |
forEach(SerializableDoubleConsumer action)
Same as
DoubleStream.forEach(DoubleConsumer) except that the DoubleConsumer must also
implement Serializable |
default <K,V> void |
forEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
|
DoubleCacheStream |
limit(long maxSize) |
DoubleCacheStream |
map(DoubleUnaryOperator mapper) |
default DoubleCacheStream |
map(SerializableDoubleUnaryOperator mapper)
Same as
map(DoubleUnaryOperator) except that the DoubleUnaryOperator must also
implement Serializable |
IntCacheStream |
mapToInt(DoubleToIntFunction mapper) |
default IntCacheStream |
mapToInt(SerializableDoubleToIntFunction mapper)
Same as
mapToInt(DoubleToIntFunction) except that the DoubleToIntFunction must also
implement Serializable |
LongCacheStream |
mapToLong(DoubleToLongFunction mapper) |
default LongCacheStream |
mapToLong(SerializableDoubleToLongFunction mapper)
Same as
mapToLong(DoubleToLongFunction) except that the DoubleToLongFunction must also
implement Serializable |
<U> CacheStream<U> |
mapToObj(DoubleFunction<? extends U> mapper) |
default <U> CacheStream<U> |
mapToObj(SerializableDoubleFunction<? extends U> mapper)
Same as
mapToObj(DoubleFunction) except that the DoubleFunction must also
implement Serializable |
default boolean |
noneMatch(SerializableDoublePredicate predicate)
Same as
DoubleStream.noneMatch(DoublePredicate) except that the DoublePredicate must
also implement Serializable |
DoubleCacheStream |
onClose(Runnable closeHandler) |
DoubleCacheStream |
parallel() |
DoubleCacheStream |
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.
|
DoubleCacheStream |
peek(DoubleConsumer action) |
default DoubleCacheStream |
peek(SerializableDoubleConsumer action)
Same as
flatMap(DoubleFunction) except that the DoubleFunction must also
implement Serializable |
default double |
reduce(double identity,
SerializableDoubleBinaryOperator op)
Same as
DoubleStream.reduce(double, DoubleBinaryOperator) except that the DoubleBinaryOperator must
also implement Serializable |
default OptionalDouble |
reduce(SerializableDoubleBinaryOperator op)
Same as
DoubleStream.reduce(DoubleBinaryOperator) except that the DoubleBinaryOperator must
also implement Serializable |
DoubleCacheStream |
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed
processing.
|
DoubleCacheStream |
sequential() |
DoubleCacheStream |
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.
|
DoubleCacheStream |
skip(long n) |
DoubleCacheStream |
sorted() |
DoubleCacheStream |
timeout(long timeout,
TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.
|
DoubleCacheStream |
unordered() |
allMatch, anyMatch, average, builder, collect, concat, count, empty, findAny, findFirst, forEach, forEachOrdered, generate, iterate, iterator, max, min, noneMatch, of, of, reduce, reduce, spliterator, sum, summaryStatistics, toArray
filterKeySegments
close, isParallel
DoubleCacheStream sequentialDistribution()
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
sequentialDistribution
in interface BaseCacheStream<Double,DoubleStream>
DoubleCacheStream parallelDistribution()
BaseCacheStream
Parallel distribution is enabled by default except for CacheStream.iterator()
and
CacheStream.spliterator()
parallelDistribution
in interface BaseCacheStream<Double,DoubleStream>
DoubleCacheStream filterKeySegments(Set<Integer> segments)
CacheStream.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<Double,DoubleStream>
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.DoubleCacheStream filterKeys(Set<?> keys)
CacheStream.filter(Predicate)
if the filter is holding references to the same
keys.filterKeys
in interface BaseCacheStream<Double,DoubleStream>
keys
- The keys that this stream will only operate on.DoubleCacheStream distributedBatchSize(int batchSize)
CacheStream.iterator()
, CacheStream.spliterator()
,
CacheStream.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 CacheStream.sorted()
, CacheStream.sorted(Comparator)
,
CacheStream.distinct()
, CacheStream.limit(long)
, CacheStream.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<Double,DoubleStream>
batchSize
- The size of each batch. This defaults to the state transfer chunk size.DoubleCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
This method is designed for the sole purpose of use with the CacheStream.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 CacheStream.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<Double,DoubleStream>
listener
- The listener that will be called back as segments are completed.DoubleCacheStream 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<Double,DoubleStream>
DoubleCacheStream 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<Double,DoubleStream>
timeout
- the maximum time to waitunit
- the time unit of the timeout argumentDoubleCacheStream filter(DoublePredicate predicate)
filter
in interface DoubleStream
default DoubleCacheStream filter(SerializableDoublePredicate predicate)
filter(DoublePredicate)
except that the DoublePredicate 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 includedDoubleCacheStream map(DoubleUnaryOperator mapper)
map
in interface DoubleStream
default DoubleCacheStream map(SerializableDoubleUnaryOperator mapper)
map(DoubleUnaryOperator)
except that the DoubleUnaryOperator 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<U> CacheStream<U> mapToObj(DoubleFunction<? extends U> mapper)
mapToObj
in interface DoubleStream
default <U> CacheStream<U> mapToObj(SerializableDoubleFunction<? extends U> mapper)
mapToObj(DoubleFunction)
except that the DoubleFunction must also
implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
U
- the element type of the new streammapper
- a non-interfering, stateless
function to apply to each elementIntCacheStream mapToInt(DoubleToIntFunction mapper)
mapToInt
in interface DoubleStream
default IntCacheStream mapToInt(SerializableDoubleToIntFunction mapper)
mapToInt(DoubleToIntFunction)
except that the DoubleToIntFunction 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(DoubleToLongFunction mapper)
mapToLong
in interface DoubleStream
default LongCacheStream mapToLong(SerializableDoubleToLongFunction mapper)
mapToLong(DoubleToLongFunction)
except that the DoubleToLongFunction 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 elementDoubleCacheStream flatMap(DoubleFunction<? extends DoubleStream> mapper)
flatMap
in interface DoubleStream
default DoubleCacheStream flatMap(SerializableDoubleFunction<? extends DoubleStream> mapper)
flatMap(DoubleFunction)
except that the DoubleFunction 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
DoubleStream
of new valuesDoubleCacheStream distinct()
distinct
in interface DoubleStream
DoubleCacheStream sorted()
sorted
in interface DoubleStream
DoubleCacheStream peek(DoubleConsumer action)
peek
in interface DoubleStream
default DoubleCacheStream peek(SerializableDoubleConsumer action)
flatMap(DoubleFunction)
except that the DoubleFunction 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 streamDoubleCacheStream limit(long maxSize)
limit
in interface DoubleStream
DoubleCacheStream skip(long n)
skip
in interface DoubleStream
default void forEach(SerializableDoubleConsumer action)
DoubleStream.forEach(DoubleConsumer)
except that the DoubleConsumer 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<K,V> void forEach(ObjDoubleConsumer<Cache<K,V>> action)
DoubleStream.forEach(DoubleConsumer)
except that it takes an ObjDoubleConsumer
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(SerializableObjDoubleConsumer<Cache<K,V>> action)
K
- key type of the cacheV
- value type of the cacheaction
- consumer to be ran for each element in the streamdefault double reduce(double identity, SerializableDoubleBinaryOperator op)
DoubleStream.reduce(double, DoubleBinaryOperator)
except that the DoubleBinaryOperator must
also implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
identity
- the identity value for the accumulating functionop
- an associative, non-interfering, stateless
function for combining two valuesdefault OptionalDouble reduce(SerializableDoubleBinaryOperator op)
DoubleStream.reduce(DoubleBinaryOperator)
except that the DoubleBinaryOperator must
also implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
op
- an associative, non-interfering, stateless
function for combining two valuesdefault <R> R collect(SerializableSupplier<R> supplier, SerializableObjDoubleConsumer<R> accumulator, SerializableBiConsumer<R,R> combiner)
DoubleStream.collect(Supplier, ObjDoubleConsumer, BiConsumer)
except that the arguments must
also implement Serializable
The compiler will pick this overload for lambda parameters, making them Serializable
R
- 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.accumulator
- an associative, non-interfering, stateless
function for incorporating an additional element into a resultcombiner
- an associative, non-interfering, stateless
function for combining two values, which must be
compatible with the accumulator functiondefault boolean anyMatch(SerializableDoublePredicate predicate)
DoubleStream.anyMatch(DoublePredicate)
except that the DoublePredicate 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 streamtrue
if any elements of the stream match the provided
predicate, otherwise false
default boolean allMatch(SerializableDoublePredicate predicate)
DoubleStream.allMatch(DoublePredicate)
except that the DoublePredicate 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 streamtrue
if either all elements of the stream match the
provided predicate or the stream is empty, otherwise false
default boolean noneMatch(SerializableDoublePredicate predicate)
DoubleStream.noneMatch(DoublePredicate)
except that the DoublePredicate 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 streamtrue
if either no elements of the stream match the
provided predicate or the stream is empty, otherwise false
CacheStream<Double> boxed()
boxed
in interface DoubleStream
DoubleCacheStream sequential()
sequential
in interface BaseStream<Double,DoubleStream>
sequential
in interface DoubleStream
DoubleCacheStream parallel()
parallel
in interface BaseStream<Double,DoubleStream>
parallel
in interface DoubleStream
DoubleCacheStream unordered()
unordered
in interface BaseStream<Double,DoubleStream>
DoubleCacheStream onClose(Runnable closeHandler)
onClose
in interface BaseStream<Double,DoubleStream>
Copyright © 2021 JBoss by Red Hat. All rights reserved.