Pipe { public Pipe(Function<T> fun) { this.fun = fun; output = new ArrayList<T>(); collector = new OutputCollector(); head = this; } Pipe(Function<T> fun);  Pipe(Pipe<T> previous, Function<T> fun); List<T> process(T elem); public ArrayList<T> output; }
@Test public void pipe() { Pipe<String> pipe = new Pipe<String>(new AppendOne()); pipe = new Pipe<String>(pipe, new AppendOne()); List<String> result = pipe.process(""); assertEquals("11",result.get(0)); }