List of usage examples for java.util.stream Collector accumulator
BiConsumer<A, T> accumulator();
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)); }// w ww. j a v a2 s . co m 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. j a v a 2s .com*/ return collector.finisher().apply(accumulator); }