@Test public void shouldAddElementsToAListOfTheSpecifiedImplementationInTheOrderTheyWereAddedToTheBuilder() throws Exception { List<Integer> expected = new ArrayList<Integer>(listWith(8, 7, 6, 5, 4)); ListBuilder<Integer> listBuilder = listBuilderWith(8, 7) .and(6, 5) .and(4); List<Integer> actual = listBuilder.build(ArrayList.class); assertThat(actual, hasOnlyItemsInOrder(expected)); }
@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);  }