public class LocalLongCacheStream extends AbstractLocalCacheStream<Long,LongStream,LongCacheStream> implements LongCacheStream
AbstractLocalCacheStream.StreamSupplier<T,S extends BaseStream<T,S>>LongStream.BuilderBaseCacheStream.SegmentCompletionListenerintermediateOperations, keysToFilter, onCloseRunnables, parallel, registry, segmentsToFilter, streamSupplier| Constructor and Description |
|---|
LocalLongCacheStream(AbstractLocalCacheStream.StreamSupplier<Long,LongStream> streamSupplier,
boolean parallel,
ComponentRegistry registry) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allMatch(LongPredicate predicate) |
boolean |
anyMatch(LongPredicate predicate) |
DoubleCacheStream |
asDoubleStream() |
OptionalDouble |
average() |
CacheStream<Long> |
boxed() |
<R> R |
collect(Supplier<R> supplier,
ObjLongConsumer<R> accumulator,
BiConsumer<R,R> combiner) |
long |
count() |
LocalLongCacheStream |
disableRehashAware()
Disables tracking of rehash events that could occur to the underlying cache.
|
LocalLongCacheStream |
distinct() |
LocalLongCacheStream |
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.
|
LocalLongCacheStream |
filter(LongPredicate predicate) |
LocalLongCacheStream |
filterKeys(Set<?> keys)
Filters which entries are returned by only returning ones that map to the given key.
|
LocalLongCacheStream |
filterKeySegments(IntSet segments)
Filters which entries are returned by what segment they are present in.
|
LocalLongCacheStream |
filterKeySegments(Set<Integer> segments)
Filters which entries are returned by what segment they are present in.
|
OptionalLong |
findAny() |
OptionalLong |
findFirst() |
LocalLongCacheStream |
flatMap(LongFunction<? extends LongStream> mapper) |
void |
forEach(LongConsumer action) |
<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. |
void |
forEachOrdered(LongConsumer action) |
PrimitiveIterator.OfLong |
iterator() |
LocalLongCacheStream |
limit(long maxSize) |
LocalLongCacheStream |
map(LongUnaryOperator mapper) |
LocalDoubleCacheStream |
mapToDouble(LongToDoubleFunction mapper) |
LocalIntCacheStream |
mapToInt(LongToIntFunction mapper) |
<U> LocalCacheStream<U> |
mapToObj(LongFunction<? extends U> mapper) |
OptionalLong |
max() |
OptionalLong |
min() |
boolean |
noneMatch(LongPredicate predicate) |
LocalLongCacheStream |
parallelDistribution()
This would enable sending requests to all other remote nodes when a terminal operator is performed.
|
LocalLongCacheStream |
peek(LongConsumer action) |
OptionalLong |
reduce(LongBinaryOperator op) |
long |
reduce(long identity,
LongBinaryOperator op) |
LocalLongCacheStream |
segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
Allows registration of a segment completion listener that is notified when a segment has completed
processing.
|
LocalLongCacheStream |
sequentialDistribution()
This would disable sending requests to all other remote nodes compared to one at a time.
|
LocalLongCacheStream |
skip(long n) |
LocalLongCacheStream |
sorted() |
Spliterator.OfLong |
spliterator() |
long |
sum() |
LongSummaryStatistics |
summaryStatistics() |
LocalLongCacheStream |
timeout(long timeout,
TimeUnit unit)
Sets a given time to wait for a remote operation to respond by.
|
long[] |
toArray() |
close, createStream, isParallel, onClose, parallel, sequential, unorderedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitallMatch, anyMatch, collect, filter, flatMap, forEach, forEach, map, mapToDouble, mapToInt, mapToObj, noneMatch, onClose, parallel, peek, reduce, reduce, sequential, unorderedbuilder, concat, empty, generate, iterate, of, of, range, rangeClosedclose, isParallelpublic LocalLongCacheStream(AbstractLocalCacheStream.StreamSupplier<Long,LongStream> streamSupplier, boolean parallel, ComponentRegistry registry)
public LocalLongCacheStream filter(LongPredicate predicate)
LongCacheStreamfilter in interface LongStreamfilter in interface LongCacheStreampublic LocalLongCacheStream map(LongUnaryOperator mapper)
LongCacheStreammap in interface LongStreammap in interface LongCacheStreampublic <U> LocalCacheStream<U> mapToObj(LongFunction<? extends U> mapper)
LongCacheStreammapToObj in interface LongStreammapToObj in interface LongCacheStreampublic LocalIntCacheStream mapToInt(LongToIntFunction mapper)
LongCacheStreammapToInt in interface LongStreammapToInt in interface LongCacheStreampublic LocalDoubleCacheStream mapToDouble(LongToDoubleFunction mapper)
LongCacheStreammapToDouble in interface LongStreammapToDouble in interface LongCacheStreampublic LocalLongCacheStream flatMap(LongFunction<? extends LongStream> mapper)
LongCacheStreamflatMap in interface LongStreamflatMap in interface LongCacheStreampublic LocalLongCacheStream distinct()
LongCacheStreamdistinct in interface LongStreamdistinct in interface LongCacheStreampublic LocalLongCacheStream sorted()
LongCacheStreamsorted in interface LongStreamsorted in interface LongCacheStreampublic LocalLongCacheStream peek(LongConsumer action)
LongCacheStreampeek in interface LongStreampeek in interface LongCacheStreampublic LocalLongCacheStream limit(long maxSize)
LongCacheStreamlimit in interface LongStreamlimit in interface LongCacheStreampublic LocalLongCacheStream skip(long n)
LongCacheStreamskip in interface LongStreamskip in interface LongCacheStreampublic void forEach(LongConsumer action)
forEach in interface LongStreampublic <K,V> void forEach(ObjLongConsumer<Cache<K,V>> action)
LongCacheStreamLongStream.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.
forEach in interface LongCacheStreamK - key type of the cacheV - value type of the cacheaction - consumer to be ran for each element in the streampublic void forEachOrdered(LongConsumer action)
forEachOrdered in interface LongStreampublic long[] toArray()
toArray in interface LongStreampublic long reduce(long identity,
LongBinaryOperator op)
reduce in interface LongStreampublic OptionalLong reduce(LongBinaryOperator op)
reduce in interface LongStreampublic <R> R collect(Supplier<R> supplier, ObjLongConsumer<R> accumulator, BiConsumer<R,R> combiner)
collect in interface LongStreampublic long sum()
sum in interface LongStreampublic OptionalLong min()
min in interface LongStreampublic OptionalLong max()
max in interface LongStreampublic long count()
count in interface LongStreampublic OptionalDouble average()
average in interface LongStreampublic LongSummaryStatistics summaryStatistics()
summaryStatistics in interface LongStreampublic boolean anyMatch(LongPredicate predicate)
anyMatch in interface LongStreampublic boolean allMatch(LongPredicate predicate)
allMatch in interface LongStreampublic boolean noneMatch(LongPredicate predicate)
noneMatch in interface LongStreampublic OptionalLong findFirst()
findFirst in interface LongStreampublic OptionalLong findAny()
findAny in interface LongStreampublic DoubleCacheStream asDoubleStream()
LongCacheStreamasDoubleStream in interface LongStreamasDoubleStream in interface LongCacheStreampublic CacheStream<Long> boxed()
LongCacheStreamboxed in interface LongStreamboxed in interface LongCacheStreampublic PrimitiveIterator.OfLong iterator()
iterator in interface BaseStream<Long,LongStream>iterator in interface LongStreampublic Spliterator.OfLong spliterator()
spliterator in interface BaseStream<Long,LongStream>spliterator in interface LongStreampublic LocalLongCacheStream sequentialDistribution()
LongCacheStreamParallel distribution is enabled by default except for CacheStream.iterator() and
CacheStream.spliterator()
sequentialDistribution in interface BaseCacheStream<Long,LongStream>sequentialDistribution in interface LongCacheStreampublic LocalLongCacheStream parallelDistribution()
BaseCacheStreamParallel distribution is enabled by default except for CacheStream.iterator() and
CacheStream.spliterator()
parallelDistribution in interface BaseCacheStream<Long,LongStream>parallelDistribution in interface LongCacheStreampublic LocalLongCacheStream filterKeySegments(Set<Integer> segments)
LongCacheStreamCacheStream.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>filterKeySegments in interface LongCacheStreamsegments - The segments to use for this stream operation. Any segments not in this set will be ignored.public LocalLongCacheStream filterKeySegments(IntSet segments)
BaseCacheStreamCacheStream.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.public LocalLongCacheStream filterKeys(Set<?> keys)
LongCacheStreamCacheStream.filter(Predicate) if the filter is holding references to the same
keys.filterKeys in interface BaseCacheStream<Long,LongStream>filterKeys in interface LongCacheStreamkeys - The keys that this stream will only operate on.public LocalLongCacheStream distributedBatchSize(int batchSize)
LongCacheStreamCacheStream.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>distributedBatchSize in interface LongCacheStreambatchSize - The size of each batch. This defaults to the state transfer chunk size.public LocalLongCacheStream segmentCompletionListener(BaseCacheStream.SegmentCompletionListener listener)
LongCacheStreamThis 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>segmentCompletionListener in interface LongCacheStreamlistener - The listener that will be called back as segments are completed.public LocalLongCacheStream disableRehashAware()
LongCacheStreamMost 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>disableRehashAware in interface LongCacheStreampublic LocalLongCacheStream timeout(long timeout, TimeUnit unit)
LongCacheStreamIf 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 in interface LongCacheStreamtimeout - the maximum time to waitunit - the time unit of the timeout argumentCopyright © 2022 JBoss by Red Hat. All rights reserved.