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.d.*;
import org.infinispan.stream.impl.termop.primitive.ForEachDoubleOperation;
import org.infinispan.stream.impl.termop.primitive.ForEachFlatMapDoubleOperation;
import java.util.Arrays;
import java.util.DoubleSummaryStatistics;
import java.util.Iterator;
import java.util.OptionalDouble;
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 DoubleStream} that utilizes a lazily evaluated distributed back end execution. Note this
* class is only able to be created using {@link org.infinispan.CacheStream#mapToDouble(ToDoubleFunction)} or similar
* methods from the {@link org.infinispan.CacheStream} interface.
*/
public class DistributedDoubleCacheStream extends AbstractCacheStream
implements DoubleStream {
/**
* This constructor is to be used only when a user calls a map or flat map method changing to a DoubleStream
* from a CacheStream, Stream, IntStream, LongStream etc.
* @param other other instance of {@link AbstractCacheStream} to copy details from
*/
protected DistributedDoubleCacheStream(AbstractCacheStream other) {
super(other);
}
@Override
protected DoubleStream unwrap() {
return this;
}
@Override
public DoubleStream filter(DoublePredicate predicate) {
return addIntermediateOperation(new FilterDoubleOperation(predicate));
}
@Override
public DoubleStream map(DoubleUnaryOperator mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperation(new MapDoubleOperation(mapper));
}
@Override
public Stream mapToObj(DoubleFunction extends U> mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToObjDoubleOperation<>(mapper), cacheStream());
}
@Override
public IntStream mapToInt(DoubleToIntFunction mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToIntDoubleOperation(mapper), intCacheStream());
}
@Override
public LongStream mapToLong(DoubleToLongFunction mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToLongDoubleOperation(mapper), longCacheStream());
}
@Override
public DoubleStream flatMap(DoubleFunction extends DoubleStream> mapper) {
iteratorOperation = IteratorOperation.FLAT_MAP;
return addIntermediateOperation(new FlatMapDoubleOperation(mapper));
}
@Override
public DoubleStream distinct() {
DistinctDoubleOperation op = DistinctDoubleOperation.getInstance();
markDistinct(op, IntermediateType.DOUBLE);
return addIntermediateOperation(op);
}
@Override
public DoubleStream sorted() {
markSorted(IntermediateType.DOUBLE);
return addIntermediateOperation(SortedDoubleOperation.getInstance());
}
@Override
public DoubleStream peek(DoubleConsumer action) {
return addIntermediateOperation(new PeekDoubleOperation(action));
}
@Override
public DoubleStream limit(long maxSize) {
LimitDoubleOperation op = new LimitDoubleOperation(maxSize);
markDistinct(op, IntermediateType.DOUBLE);
return addIntermediateOperation(op);
}
@Override
public DoubleStream skip(long n) {
SkipDoubleOperation op = new SkipDoubleOperation(n);
markSkip(IntermediateType.DOUBLE);
return addIntermediateOperation(op);
}
@Override
public Stream boxed() {
return addIntermediateOperationMap(BoxedDoubleOperation.getInstance(), cacheStream());
}
// Rest are terminal operators
@Override
public void forEach(DoubleConsumer action) {
if (!rehashAware) {
performOperation(TerminalFunctions.forEachFunction(action), false, (v1, v2) -> null, null);
} else {
performRehashForEach(action);
}
}
@Override
KeyTrackingTerminalOperation