public interface LongCacheStream extends LongStream, BaseCacheStream<Long,LongStream>
LongStream that has additional methods to allow for Serializable instances. Please see
CacheStream for additional details about various methods.LongStream.BuilderBaseCacheStream.SegmentCompletionListener| Modifier and Type | Method and Description |
|---|---|
default boolean |
allMatch(SerializableLongPredicate predicate)
Same as
LongStream.allMatch(LongPredicate) except that the LongPredicate must
also implement Serializable. |
default boolean |
anyMatch(SerializableLongPredicate predicate)
Same as
LongStream.anyMatch(LongPredicate) except that the LongPredicate must
also implement Serializable. |
DoubleCacheStream |
asDoubleStream() |
CacheStream<Long> |
boxed() |
default <R> R |
collect(SerializableSupplier<R> supplier,
SerializableObjLongConsumer<R> accumulator,
SerializableBiConsumer<R,R> combiner)
Same as
LongStream.collect(Supplier, ObjLongConsumer, BiConsumer) except that the arguments must
also implement Serializable. |
LongCacheStream |
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.
|
LongCacheStream |
distinct() |
LongCacheStream |
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.
|
LongCacheStream |
filter(LongPredicate predicate) |
default LongCacheStream |
filter(SerializableLongPredicate predicate)
Same as
filter(LongPredicate) except that the LongPredicate must also
implement Serializable. |
LongCacheStream |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
LongCacheStream |
filterKeySegments(Set<Integer> segments)
Filters which entries are returned by what segment they are present in.
|
LongCacheStream |
flatMap(LongFunction<? extends LongStream> mapper) |
default LongCacheStream |
flatMap(SerializableLongFunction<? extends LongStream> mapper)
Same as
flatMap(LongFunction) except that the LongFunction must also
implement Serializable. |
<K,V> void |
forEach(ObjLongConsumer<Cache<K,V>> action)
Same as
LongStream.forEach(LongConsumer) except that it takes an ObjLongConsumer that
provides access to the underlying Cache that is backing this stream. |
default void |
forEach(SerializableLongConsumer action)
Same as
LongStream.forEach(LongConsumer) except that the LongConsumer must also
implement Serializable. |
default <K,V> void |
forEach(SerializableObjLongConsumer<Cache<K,V>> action)
|
LongCacheStream |
limit(long maxSize) |
LongCacheStream |
map(LongUnaryOperator mapper) |
default LongCacheStream |
map(SerializableLongUnaryOperator mapper)
Same as
map(LongUnaryOperator) except that the LongUnaryOperator must also
implement Serializable. |
DoubleCacheStream |
mapToDouble(LongToDoubleFunction mapper) |
default DoubleCacheStream |
mapToDouble(SerializableLongToDoubleFunction mapper)
Same as
mapToDouble(LongToDoubleFunction) except that the LongToLongFunction must also
implement Serializable. |
IntCacheStream |
mapToInt(LongToIntFunction mapper) |
default IntCacheStream |
mapToInt(SerializableLongToIntFunction mapper)
Same as
mapToInt(LongToIntFunction) except that the LongToIntFunction must also
implement Serializable. |
<U> CacheStream<U> |
mapToObj(LongFunction<? extends U> mapper) |
default <U> CacheStream<U> |
mapToObj(SerializableLongFunction<? extends U> mapper)
Same as
mapToObj(LongFunction) except that the LongFunction must also
implement Serializable. |
default boolean |
noneMatch(SerializableLongPredicate predicate)
Same as
LongStream.noneMatch(LongPredicate) except that the LongPredicate must
also implement Serializable. |
LongCacheStream |
onClose(Runnable closeHandler) |
LongCacheStream |
parallel() |
LongCacheStream |
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.
|
LongCacheStream |
peek(LongConsumer action) |
default LongCacheStream |
peek(SerializableLongConsumer action)
Same as
flatMap(LongFunction) except that the LongFunction must also
implement Serializable. |
default long |
reduce(long identity,
SerializableLongBinaryOperator op)
Same as
LongStream.reduce(long, LongBinaryOperator) except that the LongBinaryOperator must
also implement Serializable. |
default OptionalLong |
reduce(SerializableLongBinaryOperator op)
Same as
LongStream.reduce(LongBinaryOperator) except that the LongBinaryOperator must
also implement Serializable. |
LongCacheStream |
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed
processing.
|
LongCacheStream |
sequential() |
LongCacheStream |
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.
|
LongCacheStream |
skip(long n) |
LongCacheStream |
sorted() |
LongCacheStream |
timeout(long timeout,
TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.
|
LongCacheStream |
unordered() |
allMatch, anyMatch, average, builder, collect, concat, count, empty, findAny, findFirst, forEach, forEachOrdered, generate, iterate, iterator, max, min, noneMatch, of, of, range, rangeClosed, reduce, reduce, spliterator, sum, summaryStatistics, toArrayclose, isParallelLongCacheStream sequentialDistribution()
Parallel distribution is enabled by default except for CacheStream.iterator() &
CacheStream.spliterator()
sequentialDistribution in interface BaseCacheStream<Long,LongStream>LongCacheStream parallelDistribution()
BaseCacheStreamParallel distribution is enabled by default except for CacheStream.iterator() &
CacheStream.spliterator()
parallelDistribution in interface BaseCacheStream<Long,LongStream>LongCacheStream 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<Long,LongStream>segments - The segments to use for this stream operation. Any segments not in this set will be ignored.LongCacheStream filterKeys(Set<?> keys)
CacheStream.filter(Predicate) if the filter is holding references to the same
keys.filterKeys in interface BaseCacheStream<Long,LongStream>keys - The keys that this stream will only operate on.LongCacheStream 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<Long,LongStream>batchSize - The size of each batch. This defaults to the state transfer chunk size.LongCacheStream 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<Long,LongStream>listener - The listener that will be called back as segments are completed.LongCacheStream 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<Long,LongStream>LongCacheStream 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<Long,LongStream>timeout - the maximum time to waitunit - the time unit of the timeout argumentLongCacheStream filter(LongPredicate predicate)
filter in interface LongStreamdefault LongCacheStream filter(SerializableLongPredicate predicate)
filter(LongPredicate) except that the LongPredicate must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
predicate - a non-interfering, stateless
predicate to apply to each element to determine if it
should be includedLongCacheStream map(LongUnaryOperator mapper)
map in interface LongStreamdefault LongCacheStream map(SerializableLongUnaryOperator mapper)
map(LongUnaryOperator) except that the LongUnaryOperator must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
mapper - a non-interfering, stateless
function to apply to each element<U> CacheStream<U> mapToObj(LongFunction<? extends U> mapper)
mapToObj in interface LongStreamdefault <U> CacheStream<U> mapToObj(SerializableLongFunction<? extends U> mapper)
mapToObj(LongFunction) except that the LongFunction must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
U - the element type of the new streammapper - a non-interfering, stateless
function to apply to each elementIntCacheStream mapToInt(LongToIntFunction mapper)
mapToInt in interface LongStreamdefault IntCacheStream mapToInt(SerializableLongToIntFunction mapper)
mapToInt(LongToIntFunction) except that the LongToIntFunction must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
mapper - a non-interfering, stateless
function to apply to each elementDoubleCacheStream mapToDouble(LongToDoubleFunction mapper)
mapToDouble in interface LongStreamdefault DoubleCacheStream mapToDouble(SerializableLongToDoubleFunction mapper)
mapToDouble(LongToDoubleFunction) except that the LongToLongFunction must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
mapper - a non-interfering, stateless
function to apply to each elementLongCacheStream flatMap(LongFunction<? extends LongStream> mapper)
flatMap in interface LongStreamdefault LongCacheStream flatMap(SerializableLongFunction<? extends LongStream> mapper)
flatMap(LongFunction) except that the LongFunction must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
mapper - a non-interfering, stateless
function to apply to each element which produces a
LongStream of new valuesLongCacheStream distinct()
distinct in interface LongStreamLongCacheStream sorted()
sorted in interface LongStreamLongCacheStream peek(LongConsumer action)
peek in interface LongStreamdefault LongCacheStream peek(SerializableLongConsumer action)
flatMap(LongFunction) except that the LongFunction must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
action - a non-interfering action to perform on the elements as
they are consumed from the streamLongCacheStream limit(long maxSize)
limit in interface LongStreamLongCacheStream skip(long n)
skip in interface LongStreamdefault void forEach(SerializableLongConsumer action)
LongStream.forEach(LongConsumer) except that the LongConsumer must also
implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
action - a non-interfering action to perform on the elements<K,V> void forEach(ObjLongConsumer<Cache<K,V>> action)
LongStream.forEach(LongConsumer) except that it takes an ObjLongConsumer 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(SerializableObjLongConsumer<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 long reduce(long identity,
SerializableLongBinaryOperator op)
LongStream.reduce(long, LongBinaryOperator) except that the LongBinaryOperator must
also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
identity - the identity value for the accumulating functionop - an associative, non-interfering, stateless
function for combining two valuesdefault OptionalLong reduce(SerializableLongBinaryOperator op)
LongStream.reduce(LongBinaryOperator) except that the LongBinaryOperator must
also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
op - an associative, non-interfering, stateless
function for combining two valuesdefault <R> R collect(SerializableSupplier<R> supplier, SerializableObjLongConsumer<R> accumulator, SerializableBiConsumer<R,R> combiner)
LongStream.collect(Supplier, ObjLongConsumer, BiConsumer) except that the arguments must
also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
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(SerializableLongPredicate predicate)
LongStream.anyMatch(LongPredicate) except that the LongPredicate must
also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
predicate - a non-interfering, stateless
predicate to apply to elements of this streamtrue if any elements of the stream match the provided
predicate, otherwise falsedefault boolean allMatch(SerializableLongPredicate predicate)
LongStream.allMatch(LongPredicate) except that the LongPredicate must
also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
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 falsedefault boolean noneMatch(SerializableLongPredicate predicate)
LongStream.noneMatch(LongPredicate) except that the LongPredicate must
also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
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 falseCacheStream<Long> boxed()
boxed in interface LongStreamDoubleCacheStream asDoubleStream()
asDoubleStream in interface LongStreamLongCacheStream sequential()
sequential in interface BaseStream<Long,LongStream>sequential in interface LongStreamLongCacheStream parallel()
parallel in interface BaseStream<Long,LongStream>parallel in interface LongStreamLongCacheStream unordered()
unordered in interface BaseStream<Long,LongStream>LongCacheStream onClose(Runnable closeHandler)
onClose in interface BaseStream<Long,LongStream>Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.