ModelCollector implements Collector<Statement, Model, Model> { public static ModelCollector toModel() { return new ModelCollector(); } ModelCollector();  ModelCollector(ModelFactory factory); static ModelCollector toModel(); static ModelCollector toTreeModel(); @Override Supplier<Model> supplier(); @Override BiConsumer<Model, Statement> accumulator(); @Override BinaryOperator<Model> combiner(); @Override Function<Model, Model> finisher(); @Override Set<Characteristics> characteristics();  }
@Test public void testCollector() { Model m = stmts.stream().collect(ModelCollector.toModel()); assertEquals("Number of statements does not match", m.size(), nrStmts); }
@Test public void testCollectorParallel() { Model m = stmts.parallelStream().collect(ModelCollector.toModel()); assertEquals("Number of statements does not match", m.size(), nrStmts); }