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.i.*;
import org.infinispan.stream.impl.termop.primitive.ForEachFlatMapIntOperation;
import org.infinispan.stream.impl.termop.primitive.ForEachIntOperation;
import java.util.*;
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 IntStream} 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 DistributedIntCacheStream extends AbstractCacheStream
implements IntStream {
/**
* 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, LongStream etc.
* @param other other instance of {@link AbstractCacheStream} to copy details from
*/
protected DistributedIntCacheStream(AbstractCacheStream other) {
super(other);
}
@Override
protected DistributedIntCacheStream unwrap() {
return this;
}
@Override
public IntStream filter(IntPredicate predicate) {
return addIntermediateOperation(new FilterIntOperation<>(predicate));
}
@Override
public IntStream map(IntUnaryOperator mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperation(new MapIntOperation(mapper));
}
@Override
public Stream mapToObj(IntFunction extends U> mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToObjIntOperation<>(mapper), cacheStream());
}
@Override
public LongStream mapToLong(IntToLongFunction mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToLongIntOperation(mapper), longCacheStream());
}
@Override
public DoubleStream mapToDouble(IntToDoubleFunction mapper) {
// Don't need to update iterator operation as we already are guaranteed to be at least MAP
return addIntermediateOperationMap(new MapToDoubleIntOperation(mapper), doubleCacheStream());
}
@Override
public IntStream flatMap(IntFunction extends IntStream> mapper) {
iteratorOperation = IteratorOperation.FLAT_MAP;
return addIntermediateOperation(new FlatMapIntOperation(mapper));
}
@Override
public IntStream distinct() {
DistinctIntOperation op = DistinctIntOperation.getInstance();
markDistinct(op, IntermediateType.INT);
return addIntermediateOperation(op);
}
@Override
public IntStream sorted() {
markSorted(IntermediateType.INT);
return addIntermediateOperation(SortedIntOperation.getInstance());
}
@Override
public IntStream peek(IntConsumer action) {
return addIntermediateOperation(new PeekIntOperation(action));
}
@Override
public IntStream limit(long maxSize) {
LimitIntOperation op = new LimitIntOperation(maxSize);
markDistinct(op, IntermediateType.INT);
return addIntermediateOperation(op);
}
@Override
public IntStream skip(long n) {
SkipIntOperation op = new SkipIntOperation(n);
markSkip(IntermediateType.INT);
return addIntermediateOperation(op);
}
@Override
public LongStream asLongStream() {
return addIntermediateOperationMap(AsLongIntOperation.getInstance(), longCacheStream());
}
@Override
public DoubleStream asDoubleStream() {
return addIntermediateOperationMap(AsDoubleIntOperation.getInstance(), doubleCacheStream());
}
@Override
public Stream boxed() {
return addIntermediateOperationMap(BoxedIntOperation.getInstance(), cacheStream());
}
// Rest are terminal operators
@Override
public void forEach(IntConsumer action) {
if (!rehashAware) {
performOperation(TerminalFunctions.forEachFunction(action), false, (v1, v2) -> null, null);
} else {
performRehashForEach(action);
}
}
@Override
KeyTrackingTerminalOperation