Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.infinispan.stream.impl;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.stream.impl.intops.primitive.l.*;
import org.infinispan.stream.impl.termop.primitive.ForEachFlatMapLongOperation;
import org.infinispan.stream.impl.termop.primitive.ForEachLongOperation;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LongSummaryStatistics;
import java.util.OptionalDouble;
import java.util.OptionalLong;
import java.util.PrimitiveIterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.*;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;
/**
* Implementation of {@link LongStream} that utilizes a lazily evaluated distributed back end execution. Note this
* class is only able to be created using {@link org.infinispan.CacheStream#mapToInt(ToIntFunction)} or similar
* methods from the {@link org.infinispan.CacheStream} interface.
*/
public class DistributedLongCacheStream extends AbstractCacheStream
implements LongStream {
/**
* This constructor is to be used only when a user calls a map or flat map method changing to an IntStream
* from a CacheStream, Stream, DoubleStream, IntStream etc.
* @param other other instance of {@link AbstractCacheStream} to copy details from
*/
protected DistributedLongCacheStream(AbstractCacheStream other) {
super(other);
}
@Override
protected LongStream unwrap() {
return this;
}
@Override
public LongStream filter(LongPredicate predicate) {
return addIntermediateOperation(new FilterLongOperation<>(predicate));
}
@Override
public LongStream map(LongUnaryOperator mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperation(new MapLongOperation(mapper));
}
@Override
public Stream mapToObj(LongFunction extends U> mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToObjLongOperation<>(mapper), cacheStream());
}
@Override
public IntStream mapToInt(LongToIntFunction mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToIntLongOperation(mapper), intCacheStream());
}
@Override
public DoubleStream mapToDouble(LongToDoubleFunction mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToDoubleLongOperation(mapper), doubleCacheStream());
}
@Override
public LongStream flatMap(LongFunction extends LongStream> mapper) {
iteratorOperation = IteratorOperation.FLAT_MAP;
return addIntermediateOperation(new FlatMapLongOperation(mapper));
}
@Override
public LongStream distinct() {
DistinctLongOperation op = DistinctLongOperation.getInstance();
markDistinct(op, IntermediateType.LONG);
return addIntermediateOperation(op);
}
@Override
public LongStream sorted() {
markSorted(IntermediateType.LONG);
return addIntermediateOperation(SortedLongOperation.getInstance());
}
@Override
public LongStream peek(LongConsumer action) {
return addIntermediateOperation(new PeekLongOperation(action));
}
@Override
public DoubleStream asDoubleStream() {
return addIntermediateOperationMap(AsDoubleLongOperation.getInstance(), doubleCacheStream());
}
@Override
public Stream boxed() {
return addIntermediateOperationMap(BoxedLongOperation.getInstance(), cacheStream());
}
@Override
public LongStream limit(long maxSize) {
LimitLongOperation op = new LimitLongOperation(maxSize);
markDistinct(op, IntermediateType.LONG);
return addIntermediateOperation(op);
}
@Override
public LongStream skip(long n) {
SkipLongOperation op = new SkipLongOperation(n);
markSkip(IntermediateType.LONG);
return addIntermediateOperation(op);
}
// Reset are terminal operators
@Override
public void forEach(LongConsumer action) {
if (!rehashAware) {
performOperation(TerminalFunctions.forEachFunction(action), false, (v1, v2) -> null, null);
} else {
performRehashForEach(action);
}
}
@Override
KeyTrackingTerminalOperation