@Test public void shouldPassElementsToTheSuppliedBuilderFunctionInTheOrderPassedToTheBuilder() throws Exception { CollectionBuilder<Integer> collectionBuilder = collectionBuilderWith(1, 2, 3) .and(4, 5, 6); final List<Integer> expectedElements = listWith(1, 2, 3, 4, 5, 6); collectionBuilder.build(new UnaryFunction<Iterable<Integer>, Collection<Integer>>() { @Override public Collection<Integer> call(Iterable<Integer> elements) { List<Integer> actualElements = listFrom(elements); assertThat(actualElements, hasOnlyItemsInOrder(expectedElements)); return actualElements; } }); }
@Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); } }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }  }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }  static CollectionBuilder<E> collectionBuilder(); static CollectionBuilder<E> collectionBuilder(Class<E> elementClass); @Override Collection<E> build(); @Override Collection<E> build(Class<? extends Collection> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction); }
CollectionBuilder extends AbstractBuilder<E, CollectionBuilder<E>, Collection<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Collection, Collection<E>> { @Override public Collection<E> build() { return Collections.unmodifiableList(new ArrayList<E>(elements)); }  static CollectionBuilder<E> collectionBuilder(); static CollectionBuilder<E> collectionBuilder(Class<E> elementClass); @Override Collection<E> build(); @Override Collection<E> build(Class<? extends Collection> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction);  }