package com.wizzardo.tools.collections.flow.flows;

import com.wizzardo.tools.collections.flow.BiConsumer;
import com.wizzardo.tools.collections.flow.FlowProcessor;

/**
 * Created by wizzardo on 16.04.16.
 */
public class FlowCollectWithAccumulator<C, T> extends FlowProcessor<T, C> {
    private final BiConsumer<? super C, ? super T> accumulator;
    private final C collector;

    public FlowCollectWithAccumulator(C collector, BiConsumer<? super C, ? super T> accumulator) {
        this.accumulator = accumulator;
        this.collector = collector;
    }

    @Override
    public void process(T t) {
        accumulator.consume(collector, t);
    }

    @Override
    public C get() {
        return collector;
    }
}

@@ -103,66 +103,8 @@
 mer;
-%0Aimport com.wizzardo.tools.collections.flow.FlowProcessor;
 %0A%0A/*
@@ -210,18 +210,21 @@
 wProcess
-or
+OnEnd
 %3CT, C%3E %7B
@@ -291,39 +291,8 @@
 tor;
-%0A    private final C collector;
 %0A%0A  
@@ -441,25 +441,22 @@
    this.
-collector
+result
  = colle
@@ -545,89 +545,18 @@
 ume(
-collector, t);%0A    %7D%0A%0A    @Override%0A    public C get() %7B%0A        return collector
+result, t)
 ;%0A  

update 'collect with accumulator'