### Question:
BaseGenerator implements Generator<E> { public final <T> T to(Function<Generator<? extends E>, ? extends T> transformer) { return transformer.evaluate(this); } BaseGenerator(); final T to(Function<Generator<? extends E>, ? extends T> transformer); final C to(C collection); final Collection<E> toCollection();  }### Answer:
@Test public void testTo() { Collection<Integer> col = simpleGenerator.to(CollectionTransformer.<Integer> toCollection()); assertEquals("[0, 1, 2, 3, 4]", col.toString()); Collection<Integer> fillThis = new LinkedList<Integer>(); col = simpleGenerator.to(new CollectionTransformer<Integer, Collection<Integer>>(fillThis)); assertSame(fillThis, col); assertEquals("[0, 1, 2, 3, 4]", col.toString()); col = (Collection<Integer>) simpleGenerator.toCollection(); assertEquals("[0, 1, 2, 3, 4]", col.toString()); assertEquals("[0, 1, 2, 3, 4]", col.toString()); fillThis = new LinkedList<Integer>(); col = (Collection<Integer>) simpleGenerator.to(fillThis); assertSame(fillThis, col); assertEquals("[0, 1, 2, 3, 4]", col.toString()); }