Please wait. This can take some minutes ...
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.
org.infinispan.stream.impl.TerminalFunctions Maven / Gradle / Ivy
package org.infinispan.stream.impl;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Comparator;
import java.util.DoubleSummaryStatistics;
import java.util.IntSummaryStatistics;
import java.util.LongSummaryStatistics;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import java.util.OptionalLong;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Consumer;
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleConsumer;
import java.util.function.DoublePredicate;
import java.util.function.Function;
import java.util.function.IntBinaryOperator;
import java.util.function.IntConsumer;
import java.util.function.IntFunction;
import java.util.function.IntPredicate;
import java.util.function.LongBinaryOperator;
import java.util.function.LongConsumer;
import java.util.function.LongPredicate;
import java.util.function.ObjDoubleConsumer;
import java.util.function.ObjIntConsumer;
import java.util.function.ObjLongConsumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collector;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;
import org.infinispan.Cache;
import org.infinispan.CacheStream;
import org.infinispan.DoubleCacheStream;
import org.infinispan.IntCacheStream;
import org.infinispan.LongCacheStream;
import org.infinispan.commons.marshall.Externalizer;
import org.infinispan.commons.marshall.SerializeWith;
/**
* Static factory class used to provide marshallable terminal operations
*/
final class TerminalFunctions {
private TerminalFunctions() { }
public static Function, Boolean> allMatchFunction(Predicate super T> predicate) {
return new AllMatchFunction<>(predicate);
}
public static Function allMatchFunction(DoublePredicate predicate) {
return new AllMatchDoubleFunction<>(predicate);
}
public static Function allMatchFunction(IntPredicate predicate) {
return new AllMatchIntFunction<>(predicate);
}
public static Function allMatchFunction(LongPredicate predicate) {
return new AllMatchLongFunction<>(predicate);
}
public static Function, Boolean> anyMatchFunction(Predicate super T> predicate) {
return new AnyMatchFunction<>(predicate);
}
public static Function anyMatchFunction(DoublePredicate predicate) {
return new AnyMatchDoubleFunction<>(predicate);
}
public static Function anyMatchFunction(IntPredicate predicate) {
return new AnyMatchIntFunction<>(predicate);
}
public static Function anyMatchFunction(LongPredicate predicate) {
return new AnyMatchLongFunction<>(predicate);
}
public static Function averageDoubleFunction() {
return AverageDoubleFunction.getInstance();
}
public static Function averageIntFunction() {
return AverageIntFunction.getInstance();
}
public static Function averageLongFunction() {
return AverageLongFunction.getInstance();
}
public static Function, R> collectFunction(Supplier supplier,
BiConsumer accumulator, BiConsumer combiner) {
return new CollectFunction<>(supplier, accumulator, combiner);
}
public static Function collectFunction(Supplier supplier, ObjDoubleConsumer accumulator,
BiConsumer combiner) {
return new CollectDoubleFunction<>(supplier, accumulator, combiner);
}
public static Function collectFunction(Supplier supplier, ObjIntConsumer accumulator,
BiConsumer combiner) {
return new CollectIntFunction<>(supplier, accumulator, combiner);
}
public static Function collectFunction(Supplier supplier, ObjLongConsumer accumulator,
BiConsumer combiner) {
return new CollectLongFunction<>(supplier, accumulator, combiner);
}
public static Function, R> collectorFunction(Collector super T, ?, R> collector) {
return new CollectorFunction<>(collector);
}
public static Function, Long> countFunction() {
return CountFunction.getInstance();
}
public static Function countDoubleFunction() {
return CountDoubleFunction.getInstance();
}
public static Function countIntFunction() {
return CountIntFunction.getInstance();
}
public static Function countLongFunction() {
return CountLongFunction.getInstance();
}
public static Function, T> findAnyFunction() {
return FindAnyFunction.getInstance();
}
public static Function findAnyDoubleFunction() {
return FindAnyDoubleFunction.getInstance();
}
public static Function findAnyIntFunction() {
return FindAnyIntFunction.getInstance();
}
public static Function findAnyLongFunction() {
return FindAnyLongFunction.getInstance();
}
public static Function, Void> forEachFunction(Consumer super T> consumer) {
return new ForEachFunction<>(consumer);
}
public static Function, Void> forEachFunction(BiConsumer, ? super T> consumer) {
return new ForEachBiConsumerFunction<>(consumer);
}
public static Function forEachFunction(DoubleConsumer consumer) {
return new ForEachDoubleFunction<>(consumer);
}
public static Function forEachFunction(ObjDoubleConsumer> consumer) {
return new ForEachObjDoubleFunction<>(consumer);
}
public static Function forEachFunction(IntConsumer consumer) {
return new ForEachIntFunction<>(consumer);
}
public static Function forEachFunction(ObjIntConsumer> consumer) {
return new ForEachObjIntFunction<>(consumer);
}
public static Function forEachFunction(LongConsumer consumer) {
return new ForEachLongFunction<>(consumer);
}
public static Function forEachFunction(ObjLongConsumer> consumer) {
return new ForEachObjLongFunction<>(consumer);
}
public static Function, T> maxFunction(Comparator super T> comparator) {
return new MaxFunction<>(comparator);
}
public static Function maxDoubleFunction() {
return MaxDoubleFunction.getInstance();
}
public static Function maxIntFunction() {
return MaxIntFunction.getInstance();
}
public static Function maxLongFunction() {
return MaxLongFunction.getInstance();
}
public static Function, T> minFunction(Comparator super T> comparator) {
return new MinFunction<>(comparator);
}
public static Function minDoubleFunction() {
return MinDoubleFunction.getInstance();
}
public static Function minIntFunction() {
return MinIntFunction.getInstance();
}
public static Function minLongFunction() {
return MinLongFunction.getInstance();
}
public static Function, Boolean> noneMatchFunction(Predicate super T> predicate) {
return new NoneMatchFunction<>(predicate);
}
public static Function noneMatchFunction(DoublePredicate predicate) {
return new NoneMatchDoubleFunction<>(predicate);
}
public static Function noneMatchFunction(IntPredicate predicate) {
return new NoneMatchIntFunction<>(predicate);
}
public static Function noneMatchFunction(LongPredicate predicate) {
return new NoneMatchLongFunction<>(predicate);
}
public static Function, T> reduceFunction(BinaryOperator accumulator) {
return new ReduceFunction<>(accumulator);
}
public static Function reduceFunction(DoubleBinaryOperator accumulator) {
return new ReduceDoubleFunction<>(accumulator);
}
public static Function reduceFunction(IntBinaryOperator accumulator) {
return new ReduceIntFunction<>(accumulator);
}
public static Function reduceFunction(LongBinaryOperator accumulator) {
return new ReduceLongFunction<>(accumulator);
}
public static Function, T> reduceFunction(T identity, BinaryOperator accumulator) {
return new IdentityReduceFunction<>(identity, accumulator);
}
public static Function reduceFunction(double identity, DoubleBinaryOperator accumulator) {
return new IdentityReduceDoubleFunction<>(identity, accumulator);
}
public static Function reduceFunction(int identity, IntBinaryOperator accumulator) {
return new IdentityReduceIntFunction<>(identity, accumulator);
}
public static Function reduceFunction(long identity, LongBinaryOperator accumulator) {
return new IdentityReduceLongFunction<>(identity, accumulator);
}
public static Function, R> reduceFunction(R identity, BiFunction accumulator,
BinaryOperator combiner) {
return new IdentityReduceCombinerFunction<>(identity, accumulator, combiner);
}
public static Function sumDoubleFunction() {
return SumDoubleFunction.getInstance();
}
public static Function sumIntFunction() {
return SumIntFunction.getInstance();
}
public static Function sumLongFunction() {
return SumLongFunction.getInstance();
}
public static Function summaryStatisticsDoubleFunction() {
return SummaryStatisticsDoubleFunction.getInstance();
}
public static Function summaryStatisticsLongFunction() {
return SummaryStatisticsLongFunction.getInstance();
}
public static Function summaryStatisticsIntFunction() {
return SummaryStatisticsIntFunction.getInstance();
}
public static Function, Object[]> toArrayFunction() {
return ToArrayFunction.getInstance();
}
public static Function toArrayDoubleFunction() {
return ToArrayDoubleFunction.getInstance();
}
public static Function toArrayIntFunction() {
return ToArrayIntFunction.getInstance();
}
public static Function toArrayLongFunction() {
return ToArrayLongFunction.getInstance();
}
public static Function, T[]> toArrayFunction(IntFunction generator) {
return new ToArrayGeneratorFunction<>(generator);
}
@SerializeWith(value = AllMatchFunction.AllMatchFunctionExternalizer.class)
private static final class AllMatchFunction implements Function, Boolean> {
private final Predicate super T> predicate;
private AllMatchFunction(Predicate super T> predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(Stream stream) {
return stream.allMatch(predicate);
}
public static final class AllMatchFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AllMatchFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AllMatchFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AllMatchFunction((Predicate) input.readObject());
}
}
}
@SerializeWith(value = AllMatchDoubleFunction.AllMatchDoubleFunctionExternalizer.class)
private static final class AllMatchDoubleFunction implements Function {
private final DoublePredicate predicate;
private AllMatchDoubleFunction(DoublePredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(DoubleStream stream) {
return stream.allMatch(predicate);
}
public static final class AllMatchDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AllMatchDoubleFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AllMatchDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AllMatchDoubleFunction((DoublePredicate) input.readObject());
}
}
}
@SerializeWith(value = AllMatchIntFunction.AllMatchIntFunctionExternalizer.class)
private static final class AllMatchIntFunction implements Function {
private final IntPredicate predicate;
private AllMatchIntFunction(IntPredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(IntStream stream) {
return stream.allMatch(predicate);
}
public static final class AllMatchIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AllMatchIntFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AllMatchIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AllMatchIntFunction((IntPredicate) input.readObject());
}
}
}
@SerializeWith(value = AllMatchLongFunction.AllMatchLongFunctionExternalizer.class)
private static final class AllMatchLongFunction implements Function {
private final LongPredicate predicate;
private AllMatchLongFunction(LongPredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(LongStream stream) {
return stream.allMatch(predicate);
}
public static final class AllMatchLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AllMatchLongFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AllMatchLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AllMatchLongFunction((LongPredicate) input.readObject());
}
}
}
@SerializeWith(value = AnyMatchFunction.AnyMatchFunctionExternalizer.class)
private static final class AnyMatchFunction implements Function, Boolean> {
private final Predicate super T> predicate;
private AnyMatchFunction(Predicate super T> predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(Stream stream) {
return stream.anyMatch(predicate);
}
public static final class AnyMatchFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AnyMatchFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AnyMatchFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AnyMatchFunction((Predicate) input.readObject());
}
}
}
@SerializeWith(value = AnyMatchDoubleFunction.AnyMatchDoubleFunctionExternalizer.class)
private static final class AnyMatchDoubleFunction implements Function {
private final DoublePredicate predicate;
private AnyMatchDoubleFunction(DoublePredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(DoubleStream stream) {
return stream.anyMatch(predicate);
}
public static final class AnyMatchDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AnyMatchDoubleFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AnyMatchDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AnyMatchDoubleFunction((DoublePredicate) input.readObject());
}
}
}
@SerializeWith(value = AnyMatchIntFunction.AnyMatchIntFunctionExternalizer.class)
private static final class AnyMatchIntFunction implements Function {
private final IntPredicate predicate;
private AnyMatchIntFunction(IntPredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(IntStream stream) {
return stream.anyMatch(predicate);
}
public static final class AnyMatchIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AnyMatchIntFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AnyMatchIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AnyMatchIntFunction((IntPredicate) input.readObject());
}
}
}
@SerializeWith(value = AnyMatchLongFunction.AnyMatchLongFunctionExternalizer.class)
private static final class AnyMatchLongFunction implements Function {
private final LongPredicate predicate;
private AnyMatchLongFunction(LongPredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(LongStream stream) {
return stream.anyMatch(predicate);
}
public static final class AnyMatchLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AnyMatchLongFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public AnyMatchLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new AnyMatchLongFunction((LongPredicate) input.readObject());
}
}
}
@SerializeWith(value = AverageDoubleFunction.AverageDoubleFunctionExternalizer.class)
private static final class AverageDoubleFunction implements Function {
private static final AverageDoubleFunction OPERATION = new AverageDoubleFunction();
private AverageDoubleFunction() { }
public static AverageDoubleFunction getInstance() {
return OPERATION;
}
@Override
public double[] apply(DoubleStream stream) {
DoubleSummaryStatistics stats = stream.summaryStatistics();
return new double[]{stats.getSum(), stats.getCount()};
}
public static final class AverageDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AverageDoubleFunction object) throws IOException {
}
@Override
public AverageDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = AverageIntFunction.AverageIntFunctionExternalizer.class)
private static final class AverageIntFunction implements Function {
private static final AverageIntFunction OPERATION = new AverageIntFunction();
private AverageIntFunction() { }
public static AverageIntFunction getInstance() {
return OPERATION;
}
@Override
public long[] apply(IntStream stream) {
IntSummaryStatistics stats = stream.summaryStatistics();
return new long[]{stats.getSum(), stats.getCount()};
}
public static final class AverageIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AverageIntFunction object) throws IOException {
}
@Override
public AverageIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = AverageLongFunction.AverageLongFunctionExternalizer.class)
private static final class AverageLongFunction implements Function {
private static final AverageLongFunction OPERATION = new AverageLongFunction();
private AverageLongFunction() { }
public static AverageLongFunction getInstance() {
return OPERATION;
}
@Override
public long[] apply(LongStream stream) {
LongSummaryStatistics stats = stream.summaryStatistics();
return new long[]{stats.getSum(), stats.getCount()};
}
public static final class AverageLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, AverageLongFunction object) throws IOException {
}
@Override
public AverageLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = CountFunction.CountFunctionExternalizer.class)
private static final class CountFunction implements Function, Long> {
private static final CountFunction> OPERATION = new CountFunction<>();
private CountFunction() { }
public static CountFunction getInstance() {
return (CountFunction) OPERATION;
}
@Override
public Long apply(Stream stream) {
return stream.count();
}
public static final class CountFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CountFunction object) throws IOException {
}
@Override
public CountFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = CountDoubleFunction.CountDoubleFunctionExternalizer.class)
private static final class CountDoubleFunction implements Function {
private static final CountDoubleFunction> OPERATION = new CountDoubleFunction<>();
private CountDoubleFunction() { }
public static CountDoubleFunction getInstance() {
return (CountDoubleFunction) OPERATION;
}
@Override
public Long apply(DoubleStream stream) {
return stream.count();
}
public static final class CountDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CountDoubleFunction object) throws IOException {
}
@Override
public CountDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = CountIntFunction.CountIntFunctionExternalizer.class)
private static final class CountIntFunction implements Function {
private static final CountIntFunction> OPERATION = new CountIntFunction<>();
private CountIntFunction() { }
public static CountIntFunction getInstance() {
return (CountIntFunction) OPERATION;
}
@Override
public Long apply(IntStream stream) {
return stream.count();
}
public static final class CountIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CountIntFunction object) throws IOException {
}
@Override
public CountIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = CountLongFunction.CountLongFunctionExternalizer.class)
private static final class CountLongFunction implements Function {
private static final CountLongFunction> OPERATION = new CountLongFunction<>();
private CountLongFunction() { }
public static CountLongFunction getInstance() {
return (CountLongFunction) OPERATION;
}
@Override
public Long apply(LongStream stream) {
return stream.count();
}
public static final class CountLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CountLongFunction object) throws IOException {
}
@Override
public CountLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = FindAnyFunction.FindAnyFunctionExternalizer.class)
private static final class FindAnyFunction implements Function, T> {
private static final FindAnyFunction> OPERATION = new FindAnyFunction<>();
private FindAnyFunction() { }
public static FindAnyFunction getInstance() {
return (FindAnyFunction) OPERATION;
}
@Override
public T apply(Stream stream) {
return stream.findAny().orElse(null);
}
public static final class FindAnyFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, FindAnyFunction object) throws IOException {
}
@Override
public FindAnyFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = FindAnyDoubleFunction.FindAnyDoubleFunctionExternalizer.class)
private static final class FindAnyDoubleFunction implements Function {
private static final FindAnyDoubleFunction OPERATION = new FindAnyDoubleFunction();
private FindAnyDoubleFunction() { }
public static FindAnyDoubleFunction getInstance() {
return (FindAnyDoubleFunction) OPERATION;
}
@Override
public Double apply(DoubleStream stream) {
OptionalDouble i = stream.findAny();
if (i.isPresent()) {
return i.getAsDouble();
} else {
return null;
}
}
public static final class FindAnyDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, FindAnyDoubleFunction object) throws IOException {
}
@Override
public FindAnyDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = FindAnyIntFunction.FindAnyIntFunctionExternalizer.class)
private static final class FindAnyIntFunction implements Function {
private static final FindAnyIntFunction OPERATION = new FindAnyIntFunction();
private FindAnyIntFunction() { }
public static FindAnyIntFunction getInstance() {
return (FindAnyIntFunction) OPERATION;
}
@Override
public Integer apply(IntStream stream) {
OptionalInt i = stream.findAny();
if (i.isPresent()) {
return i.getAsInt();
} else {
return null;
}
}
public static final class FindAnyIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, FindAnyIntFunction object) throws IOException {
}
@Override
public FindAnyIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = FindAnyLongFunction.FindAnyLongFunctionExternalizer.class)
private static final class FindAnyLongFunction implements Function {
private static final FindAnyLongFunction OPERATION = new FindAnyLongFunction();
private FindAnyLongFunction() { }
public static FindAnyLongFunction getInstance() {
return (FindAnyLongFunction) OPERATION;
}
@Override
public Long apply(LongStream stream) {
OptionalLong i = stream.findAny();
if (i.isPresent()) {
return i.getAsLong();
} else {
return null;
}
}
public static final class FindAnyLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, FindAnyLongFunction object) throws IOException {
}
@Override
public FindAnyLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return getInstance();
}
}
}
@SerializeWith(value = NoneMatchFunction.NoneMatchFunctionExternalizer.class)
private static final class NoneMatchFunction implements Function, Boolean> {
private final Predicate super T> predicate;
private NoneMatchFunction(Predicate super T> predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(Stream stream) {
return stream.noneMatch(predicate);
}
public static final class NoneMatchFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, NoneMatchFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public NoneMatchFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new NoneMatchFunction((Predicate) input.readObject());
}
}
}
@SerializeWith(value = NoneMatchDoubleFunction.NoneMatchDoubleFunctionExternalizer.class)
private static final class NoneMatchDoubleFunction implements Function {
private final DoublePredicate predicate;
private NoneMatchDoubleFunction(DoublePredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(DoubleStream stream) {
return stream.noneMatch(predicate);
}
public static final class NoneMatchDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, NoneMatchDoubleFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public NoneMatchDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new NoneMatchDoubleFunction((DoublePredicate) input.readObject());
}
}
}
@SerializeWith(value = NoneMatchIntFunction.NoneMatchIntFunctionExternalizer.class)
private static final class NoneMatchIntFunction implements Function {
private final IntPredicate predicate;
private NoneMatchIntFunction(IntPredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(IntStream stream) {
return stream.noneMatch(predicate);
}
public static final class NoneMatchIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, NoneMatchIntFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public NoneMatchIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new NoneMatchIntFunction((IntPredicate) input.readObject());
}
}
}
@SerializeWith(value = NoneMatchLongFunction.NoneMatchLongFunctionExternalizer.class)
private static final class NoneMatchLongFunction implements Function {
private final LongPredicate predicate;
private NoneMatchLongFunction(LongPredicate predicate) {
this.predicate = predicate;
}
@Override
public Boolean apply(LongStream stream) {
return stream.noneMatch(predicate);
}
public static final class NoneMatchLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, NoneMatchLongFunction object) throws IOException {
output.writeObject(object.predicate);
}
@Override
public NoneMatchLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new NoneMatchLongFunction((LongPredicate) input.readObject());
}
}
}
@SerializeWith(value = CollectFunction.CollectFunctionExternalizer.class)
private static final class CollectFunction implements Function, R> {
private final Supplier supplier;
private final BiConsumer accumulator;
private final BiConsumer combiner;
private CollectFunction(Supplier supplier, BiConsumer accumulator, BiConsumer combiner) {
this.supplier = supplier;
this.accumulator = accumulator;
this.combiner = combiner;
}
@Override
public R apply(Stream stream) {
return stream.collect(supplier, accumulator, combiner);
}
public static final class CollectFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CollectFunction object) throws IOException {
output.writeObject(object.supplier);
output.writeObject(object.accumulator);
output.writeObject(object.combiner);
}
@Override
public CollectFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new CollectFunction((Supplier) input.readObject(), (BiConsumer) input.readObject(),
(BiConsumer) input.readObject());
}
}
}
@SerializeWith(value = CollectDoubleFunction.CollectDoubleFunctionExternalizer.class)
private static final class CollectDoubleFunction implements Function {
private final Supplier supplier;
private final ObjDoubleConsumer accumulator;
private final BiConsumer combiner;
private CollectDoubleFunction(Supplier supplier, ObjDoubleConsumer accumulator, BiConsumer combiner) {
this.supplier = supplier;
this.accumulator = accumulator;
this.combiner = combiner;
}
@Override
public R apply(DoubleStream stream) {
return stream.collect(supplier, accumulator, combiner);
}
public static final class CollectDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CollectDoubleFunction object) throws IOException {
output.writeObject(object.supplier);
output.writeObject(object.accumulator);
output.writeObject(object.combiner);
}
@Override
public CollectDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new CollectDoubleFunction((Supplier) input.readObject(), (ObjDoubleConsumer) input.readObject(),
(BiConsumer) input.readObject());
}
}
}
@SerializeWith(value = CollectIntFunction.CollectIntFunctionExternalizer.class)
private static final class CollectIntFunction implements Function {
private final Supplier supplier;
private final ObjIntConsumer accumulator;
private final BiConsumer combiner;
private CollectIntFunction(Supplier supplier, ObjIntConsumer accumulator, BiConsumer combiner) {
this.supplier = supplier;
this.accumulator = accumulator;
this.combiner = combiner;
}
@Override
public R apply(IntStream stream) {
return stream.collect(supplier, accumulator, combiner);
}
public static final class CollectIntFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CollectIntFunction object) throws IOException {
output.writeObject(object.supplier);
output.writeObject(object.accumulator);
output.writeObject(object.combiner);
}
@Override
public CollectIntFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new CollectIntFunction((Supplier) input.readObject(), (ObjIntConsumer) input.readObject(),
(BiConsumer) input.readObject());
}
}
}
@SerializeWith(value = CollectLongFunction.CollectLongFunctionExternalizer.class)
private static final class CollectLongFunction implements Function {
private final Supplier supplier;
private final ObjLongConsumer accumulator;
private final BiConsumer combiner;
private CollectLongFunction(Supplier supplier, ObjLongConsumer accumulator, BiConsumer combiner) {
this.supplier = supplier;
this.accumulator = accumulator;
this.combiner = combiner;
}
@Override
public R apply(LongStream stream) {
return stream.collect(supplier, accumulator, combiner);
}
public static final class CollectLongFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CollectLongFunction object) throws IOException {
output.writeObject(object.supplier);
output.writeObject(object.accumulator);
output.writeObject(object.combiner);
}
@Override
public CollectLongFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new CollectLongFunction((Supplier) input.readObject(), (ObjLongConsumer) input.readObject(),
(BiConsumer) input.readObject());
}
}
}
@SerializeWith(value = CollectorFunction.CollectorFunctionExternalizer.class)
private static final class CollectorFunction implements Function, R> {
private final Collector super T, ?, R> collector;
private CollectorFunction(Collector super T, ?, R> collector) {
this.collector = collector;
}
@Override
public R apply(Stream stream) {
return stream.collect(collector);
}
public static final class CollectorFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, CollectorFunction object) throws IOException {
output.writeObject(object.collector);
}
@Override
public CollectorFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new CollectorFunction((Collector) input.readObject());
}
}
}
@SerializeWith(value = ForEachFunction.ForEachFunctionExternalizer.class)
private static final class ForEachFunction implements Function, Void> {
private final Consumer super T> consumer;
private ForEachFunction(Consumer super T> consumer) {
this.consumer = consumer;
}
@Override
public Void apply(Stream stream) {
stream.forEach(consumer);
return null;
}
public static final class ForEachFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, ForEachFunction object) throws IOException {
output.writeObject(object.consumer);
}
@Override
public ForEachFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new ForEachFunction((Consumer) input.readObject());
}
}
}
@SerializeWith(value = ForEachBiConsumerFunction.ForEachBiConsumerFunctionExternalizer.class)
private static final class ForEachBiConsumerFunction implements Function, Void> {
private final BiConsumer, ? super T> consumer;
private ForEachBiConsumerFunction(BiConsumer, ? super T> consumer) {
this.consumer = consumer;
}
@Override
public Void apply(CacheStream stream) {
stream.forEach(consumer);
return null;
}
public static final class ForEachBiConsumerFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, ForEachBiConsumerFunction object) throws IOException {
output.writeObject(object.consumer);
}
@Override
public ForEachBiConsumerFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new ForEachBiConsumerFunction((BiConsumer) input.readObject());
}
}
}
@SerializeWith(value = ForEachDoubleFunction.ForEachDoubleFunctionExternalizer.class)
private static final class ForEachDoubleFunction implements Function {
private final DoubleConsumer consumer;
private ForEachDoubleFunction(DoubleConsumer consumer) {
this.consumer = consumer;
}
@Override
public Void apply(DoubleStream stream) {
stream.forEach(consumer);
return null;
}
public static final class ForEachDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, ForEachDoubleFunction object) throws IOException {
output.writeObject(object.consumer);
}
@Override
public ForEachDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new ForEachDoubleFunction((DoubleConsumer) input.readObject());
}
}
}
@SerializeWith(value = ForEachObjDoubleFunction.ForEachObjDoubleFunctionExternalizer.class)
private static final class ForEachObjDoubleFunction implements Function {
private final ObjDoubleConsumer> consumer;
private ForEachObjDoubleFunction(ObjDoubleConsumer> consumer) {
this.consumer = consumer;
}
@Override
public Void apply(DoubleCacheStream stream) {
stream.forEach(consumer);
return null;
}
public static final class ForEachObjDoubleFunctionExternalizer implements Externalizer {
@Override
public void writeObject(ObjectOutput output, ForEachObjDoubleFunction object) throws IOException {
output.writeObject(object.consumer);
}
@Override
public ForEachObjDoubleFunction readObject(ObjectInput input) throws IOException, ClassNotFoundException {
return new ForEachObjDoubleFunction((ObjDoubleConsumer) input.readObject());
}
}
}
@SerializeWith(value = ForEachIntFunction.ForEachIntFunctionExternalizer.class)
private static final class ForEachIntFunction implements Function