java.util.stream.Collectors Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dragome-js-jre Show documentation
Show all versions of dragome-js-jre Show documentation
Dragome SDK module: js-jre
The newest version!
package java.util.stream;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.function.Supplier;
public final class Collectors
{
private static Function castingIdentity()
{
return i -> (R) i;
}
static class CollectorImpl implements Collector
{
private final Supplier supplier;
private final BiConsumer accumulator;
private final BinaryOperator combiner;
private final Function finisher;
private final Set characteristics;
CollectorImpl(Supplier supplier, BiConsumer accumulator, BinaryOperator combiner, Function finisher, Set characteristics)
{
this.supplier= supplier;
this.accumulator= accumulator;
this.combiner= combiner;
this.finisher= finisher;
this.characteristics= characteristics;
}
CollectorImpl(Supplier supplier, BiConsumer accumulator, BinaryOperator combiner, Set characteristics)
{
this(supplier, accumulator, combiner, castingIdentity(), characteristics);
}
public BiConsumer accumulator()
{
return accumulator;
}
public Supplier supplier()
{
return supplier;
}
public BinaryOperator combiner()
{
return combiner;
}
public Function finisher()
{
return finisher;
}
public Set characteristics()
{
return characteristics;
}
}
public static Collector> toList()
{
return new Collector>()
{
List