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