@Test public void shouldSupplyElementsToSuppliedBuilderInInsertionOrder() throws Exception { final SetBuilder<Name> setBuilder = setBuilderWith(name("James"), name("Adam"), name("Charles"), name("Amanda")) .and(iterableWith(name("Paul"), name("Sarah"))) .and(name("James")); final Iterable<Name> expected = iterableWith( name("James"), name("Adam"), name("Charles"), name("Amanda"), name("Paul"), name("Sarah"), name("James")); setBuilder.build(new UnaryFunction<Iterable<Name>, Set<Name>>() { @Override public Set<Name> call(Iterable<Name> actual) { assertThat(actual, hasOnlyItemsInOrder(expected)); return ImmutableSet.copyOf(actual); } }); }
@Override public Set<E> build() { return Collections.unmodifiableSet(new HashSet<E>(elements)); }
SetBuilder extends AbstractBuilder<E, SetBuilder<E>, Set<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Set, Set<E>> { @Override public Set<E> build() { return Collections.unmodifiableSet(new HashSet<E>(elements)); } }
SetBuilder extends AbstractBuilder<E, SetBuilder<E>, Set<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Set, Set<E>> { @Override public Set<E> build() { return Collections.unmodifiableSet(new HashSet<E>(elements)); }  }
SetBuilder extends AbstractBuilder<E, SetBuilder<E>, Set<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Set, Set<E>> { @Override public Set<E> build() { return Collections.unmodifiableSet(new HashSet<E>(elements)); }  static SetBuilder<E> setBuilder(); static SetBuilder<E> setBuilder(Class<E> elementClass); @Override Set<E> build(); @Override Set<E> build(Class<? extends Set> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction); }
SetBuilder extends AbstractBuilder<E, SetBuilder<E>, Set<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Set, Set<E>> { @Override public Set<E> build() { return Collections.unmodifiableSet(new HashSet<E>(elements)); }  static SetBuilder<E> setBuilder(); static SetBuilder<E> setBuilder(Class<E> elementClass); @Override Set<E> build(); @Override Set<E> build(Class<? extends Set> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction);  }