Interface DoubleCacheStream
-
- All Superinterfaces:
AutoCloseable
,BaseCacheStream<Double,DoubleStream>
,BaseStream<Double,DoubleStream>
,DoubleStream
public interface DoubleCacheStream extends DoubleStream, BaseCacheStream<Double,DoubleStream>
ADoubleStream
that has additional methods to allow for Serializable instances. Please seeCacheStream
for additional details about various methods.- Since:
- 9.0
- Author:
- wburns
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.BaseCacheStream
BaseCacheStream.SegmentCompletionListener
-
Nested classes/interfaces inherited from interface java.util.stream.DoubleStream
DoubleStream.Builder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
allMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.allMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
default boolean
anyMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.anyMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
CacheStream<Double>
boxed()
default <R> R
collect(SerializableSupplier<R> supplier, SerializableObjDoubleConsumer<R> accumulator, SerializableBiConsumer<R,R> combiner)
Same asDoubleStream.collect(Supplier, ObjDoubleConsumer, BiConsumer)
except that the arguments must also implementSerializable
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 asfilter(DoublePredicate)
except that the DoublePredicate must also implementSerializable
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 asflatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
<K,V>
voidforEach(ObjDoubleConsumer<Cache<K,V>> action)
Same asDoubleStream.forEach(DoubleConsumer)
except that it takes anObjDoubleConsumer
that provides access to the underlyingCache
that is backing this stream.default void
forEach(SerializableDoubleConsumer action)
Same asDoubleStream.forEach(DoubleConsumer)
except that the DoubleConsumer must also implementSerializable
default <K,V>
voidforEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
DoubleCacheStream
limit(long maxSize)
DoubleCacheStream
map(DoubleUnaryOperator mapper)
default DoubleCacheStream
map(SerializableDoubleUnaryOperator mapper)
Same asmap(DoubleUnaryOperator)
except that the DoubleUnaryOperator must also implementSerializable
IntCacheStream
mapToInt(DoubleToIntFunction mapper)
default IntCacheStream
mapToInt(SerializableDoubleToIntFunction mapper)
Same asmapToInt(DoubleToIntFunction)
except that the DoubleToIntFunction must also implementSerializable
LongCacheStream
mapToLong(DoubleToLongFunction mapper)
default LongCacheStream
mapToLong(SerializableDoubleToLongFunction mapper)
Same asmapToLong(DoubleToLongFunction)
except that the DoubleToLongFunction must also implementSerializable
<U> CacheStream<U>
mapToObj(DoubleFunction<? extends U> mapper)
default <U> CacheStream<U>
mapToObj(SerializableDoubleFunction<? extends U> mapper)
Same asmapToObj(DoubleFunction)
except that the DoubleFunction must also implementSerializable
default boolean
noneMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.noneMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
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 asflatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
default double
reduce(double identity, SerializableDoubleBinaryOperator op)
Same asDoubleStream.reduce(double, DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
default OptionalDouble
reduce(SerializableDoubleBinaryOperator op)
Same asDoubleStream.reduce(DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
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()
-
Methods inherited from interface org.infinispan.BaseCacheStream
filterKeySegments
-
Methods inherited from interface java.util.stream.BaseStream
close, isParallel
-
-
-
-
Method Detail
-
sequentialDistribution
DoubleCacheStream sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time. This can reduce memory pressure on the originator node at the cost of performance.Parallel distribution is enabled by default except for
CacheStream.iterator()
andCacheStream.spliterator()
- Specified by:
sequentialDistribution
in interfaceBaseCacheStream<Double,DoubleStream>
- Returns:
- a stream with parallel distribution disabled.
-
parallelDistribution
DoubleCacheStream parallelDistribution()
Description copied from interface:BaseCacheStream
This would enable sending requests to all other remote nodes when a terminal operator is performed. This requires additional overhead as it must process results concurrently from various nodes, but should perform faster in the majority of cases.Parallel distribution is enabled by default except for
CacheStream.iterator()
andCacheStream.spliterator()
- Specified by:
parallelDistribution
in interfaceBaseCacheStream<Double,DoubleStream>
- Returns:
- a stream with parallel distribution enabled.
-
filterKeySegments
DoubleCacheStream filterKeySegments(Set<Integer> segments)
Filters which entries are returned by what segment they are present in. This method can be substantially more efficient than using a regularCacheStream.filter(Predicate)
method as this can control what nodes are asked for data and what entries are read from the underlying CacheStore if present.- Specified by:
filterKeySegments
in interfaceBaseCacheStream<Double,DoubleStream>
- Parameters:
segments
- The segments to use for this stream operation. Any segments not in this set will be ignored.- Returns:
- a stream with the segments filtered.
-
filterKeys
DoubleCacheStream filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key. This method will be faster than a regularCacheStream.filter(Predicate)
if the filter is holding references to the same keys.- Specified by:
filterKeys
in interfaceBaseCacheStream<Double,DoubleStream>
- Parameters:
keys
- The keys that this stream will only operate on.- Returns:
- a stream with the keys filtered.
-
distributedBatchSize
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. This value is ignored when terminal operators that don't track keys are used. Key tracking terminal operators areCacheStream.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.
- Specified by:
distributedBatchSize
in interfaceBaseCacheStream<Double,DoubleStream>
- Parameters:
batchSize
- The size of each batch. This defaults to the state transfer chunk size.- Returns:
- a stream with the batch size updated
-
segmentCompletionListener
DoubleCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed processing. If the terminal operator has a short circuit this listener may never be called.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 seeCacheStream.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.- Specified by:
segmentCompletionListener
in interfaceBaseCacheStream<Double,DoubleStream>
- Parameters:
listener
- The listener that will be called back as segments are completed.- Returns:
- a stream with the listener registered.
-
disableRehashAware
DoubleCacheStream disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache. If a rehash event occurs while a terminal operation is being performed it is possible for some values that are in the cache to not be found. Note that you will never have an entry duplicated when rehash awareness is disabled, only lost values.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.
- Specified by:
disableRehashAware
in interfaceBaseCacheStream<Double,DoubleStream>
- Returns:
- a stream with rehash awareness disabled.
-
timeout
DoubleCacheStream timeout(long timeout, TimeUnit unit)
Sets a given time to wait for a remote operation to respond by. This timeout does nothing if the terminal operation does not go remote.If a timeout does occur then a
TimeoutException
is thrown from the terminal operation invoking thread or on the next call to theIterator
orSpliterator
.Note that if a rehash occurs this timeout value is reset for the subsequent retry if rehash aware is enabled.
- Specified by:
timeout
in interfaceBaseCacheStream<Double,DoubleStream>
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Returns:
- a stream with the timeout set
-
filter
DoubleCacheStream filter(DoublePredicate predicate)
- Specified by:
filter
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
filter
default DoubleCacheStream filter(SerializableDoublePredicate predicate)
Same asfilter(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to each element to determine if it should be included- Returns:
- the new cache double stream
-
map
DoubleCacheStream map(DoubleUnaryOperator mapper)
- Specified by:
map
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
map
default DoubleCacheStream map(SerializableDoubleUnaryOperator mapper)
Same asmap(DoubleUnaryOperator)
except that the DoubleUnaryOperator must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache double stream
-
mapToObj
<U> CacheStream<U> mapToObj(DoubleFunction<? extends U> mapper)
- Specified by:
mapToObj
in interfaceDoubleStream
- Returns:
- the new cache stream
-
mapToObj
default <U> CacheStream<U> mapToObj(SerializableDoubleFunction<? extends U> mapper)
Same asmapToObj(DoubleFunction)
except that the DoubleFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Type Parameters:
U
- the element type of the new stream- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache stream
-
mapToInt
IntCacheStream mapToInt(DoubleToIntFunction mapper)
- Specified by:
mapToInt
in interfaceDoubleStream
- Returns:
- the new cache int stream
-
mapToInt
default IntCacheStream mapToInt(SerializableDoubleToIntFunction mapper)
Same asmapToInt(DoubleToIntFunction)
except that the DoubleToIntFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache int stream
-
mapToLong
LongCacheStream mapToLong(DoubleToLongFunction mapper)
- Specified by:
mapToLong
in interfaceDoubleStream
- Returns:
- the new cache long stream
-
mapToLong
default LongCacheStream mapToLong(SerializableDoubleToLongFunction mapper)
Same asmapToLong(DoubleToLongFunction)
except that the DoubleToLongFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new cache long stream
-
flatMap
DoubleCacheStream flatMap(DoubleFunction<? extends DoubleStream> mapper)
- Specified by:
flatMap
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
flatMap
default DoubleCacheStream flatMap(SerializableDoubleFunction<? extends DoubleStream> mapper)
Same asflatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
mapper
- a non-interfering, stateless function to apply to each element which produces aDoubleStream
of new values- Returns:
- the new cache double stream
-
distinct
DoubleCacheStream distinct()
- Specified by:
distinct
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
sorted
DoubleCacheStream sorted()
- Specified by:
sorted
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
peek
DoubleCacheStream peek(DoubleConsumer action)
- Specified by:
peek
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
peek
default DoubleCacheStream peek(SerializableDoubleConsumer action)
Same asflatMap(DoubleFunction)
except that the DoubleFunction must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
action
- a non-interfering action to perform on the elements as they are consumed from the stream- Returns:
- the new cache double stream
-
limit
DoubleCacheStream limit(long maxSize)
- Specified by:
limit
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
skip
DoubleCacheStream skip(long n)
- Specified by:
skip
in interfaceDoubleStream
- Returns:
- the new cache double stream
-
forEach
default void forEach(SerializableDoubleConsumer action)
Same asDoubleStream.forEach(DoubleConsumer)
except that the DoubleConsumer must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
action
- a non-interfering action to perform on the elements
-
forEach
<K,V> void forEach(ObjDoubleConsumer<Cache<K,V>> action)
Same asDoubleStream.forEach(DoubleConsumer)
except that it takes anObjDoubleConsumer
that provides access to the underlyingCache
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.- Type Parameters:
K
- key type of the cacheV
- value type of the cache- Parameters:
action
- consumer to be ran for each element in the stream
-
forEach
default <K,V> void forEach(SerializableObjDoubleConsumer<Cache<K,V>> action)
- Type Parameters:
K
- key type of the cacheV
- value type of the cache- Parameters:
action
- consumer to be ran for each element in the stream
-
reduce
default double reduce(double identity, SerializableDoubleBinaryOperator op)
Same asDoubleStream.reduce(double, DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
identity
- the identity value for the accumulating functionop
- an associative, non-interfering, stateless function for combining two values- Returns:
- the result of the reduction
-
reduce
default OptionalDouble reduce(SerializableDoubleBinaryOperator op)
Same asDoubleStream.reduce(DoubleBinaryOperator)
except that the DoubleBinaryOperator must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
op
- an associative, non-interfering, stateless function for combining two values- Returns:
- the result of the reduction
-
collect
default <R> R collect(SerializableSupplier<R> supplier, SerializableObjDoubleConsumer<R> accumulator, SerializableBiConsumer<R,R> combiner)
Same asDoubleStream.collect(Supplier, ObjDoubleConsumer, BiConsumer)
except that the arguments must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Type Parameters:
R
- type of the result- Parameters:
supplier
- 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 function- Returns:
- the result of the reduction
-
anyMatch
default boolean anyMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.anyMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to elements of this stream- Returns:
true
if any elements of the stream match the provided predicate, otherwisefalse
-
allMatch
default boolean allMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.allMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to elements of this stream- Returns:
true
if either all elements of the stream match the provided predicate or the stream is empty, otherwisefalse
-
noneMatch
default boolean noneMatch(SerializableDoublePredicate predicate)
Same asDoubleStream.noneMatch(DoublePredicate)
except that the DoublePredicate must also implementSerializable
The compiler will pick this overload for lambda parameters, making them
Serializable
- Parameters:
predicate
- a non-interfering, stateless predicate to apply to elements of this stream- Returns:
true
if either no elements of the stream match the provided predicate or the stream is empty, otherwisefalse
-
boxed
CacheStream<Double> boxed()
- Specified by:
boxed
in interfaceDoubleStream
- Returns:
- the new cache stream containing doubles
-
sequential
DoubleCacheStream sequential()
- Specified by:
sequential
in interfaceBaseStream<Double,DoubleStream>
- Specified by:
sequential
in interfaceDoubleStream
- Returns:
- a sequential cache double stream
-
parallel
DoubleCacheStream parallel()
- Specified by:
parallel
in interfaceBaseStream<Double,DoubleStream>
- Specified by:
parallel
in interfaceDoubleStream
- Returns:
- a parallel cache double stream
-
unordered
DoubleCacheStream unordered()
- Specified by:
unordered
in interfaceBaseStream<Double,DoubleStream>
- Returns:
- an unordered cache double stream
-
onClose
DoubleCacheStream onClose(Runnable closeHandler)
- Specified by:
onClose
in interfaceBaseStream<Double,DoubleStream>
- Returns:
- a cache double stream with the handler applied
-
-