ScrapCounter implements ScrapConsumer<K,Object> { public static <K> ScrapCounter<K> of(Conveyor<K,?,?> conv) { return new ScrapCounter<>(); } ScrapCounter();  ScrapCounter(Predicate<ScrapBin<K,?>> filter); @Override void accept(ScrapBin<K,Object> bin); long get(); static ScrapCounter<K> of(Conveyor<K,?,?> conv); static ScrapCounter<K> of(Conveyor<K,?,?> conv, Predicate<ScrapBin<K,?>> filter); @Override String toString();  }
@Test public void testOf() { AssemblingConveyor<Integer,String,String> ac = new AssemblingConveyor<>(); ScrapCounter<Integer> sc1 = ScrapCounter.of(ac); ScrapCounter<Integer> sc2 = ScrapCounter.of(ac,x->true); sc1.accept(null); assertEquals(1,sc1.get()); System.out.println(sc1); }