List of usage examples for java.util.stream Collector finisher
Function<A, R> finisher();
From source file:org.briljantframework.array.AbstractDoubleArray.java
@Override public <R, C> R collect(Collector<? super Double, C, R> collector) { C accum = collector.supplier().get(); for (int i = 0; i < size(); i++) { collector.accumulator().accept(accum, get(i)); }// www .j a v a 2 s .c om return collector.finisher().apply(accum); }
From source file:org.briljantframework.data.Collectors.java
public static <T, A, R, F> Collector<T, ?, F> withFinisher(Collector<T, A, R> collector, Function<R, F> finisher) { Function<A, R> f = collector.finisher(); Set<Collector.Characteristics> characteristics = collector.characteristics(); Collector.Characteristics[] empty = new Collector.Characteristics[characteristics.size()]; return Collector.of(collector.supplier(), collector.accumulator(), collector.combiner(), f.andThen(finisher), characteristics.toArray(empty)); }
From source file:org.briljantframework.data.vector.AbstractVector.java
@Override public <T, R, C> R collect(Class<T> in, Collector<? super T, C, ? extends R> collector) { C accumulator = collector.supplier().get(); for (int i = 0; i < size(); i++) { collector.accumulator().accept(accumulator, loc().get(in, i)); }//from w w w. ja v a 2 s .c o m return collector.finisher().apply(accumulator); }