@Test public void shouldPassElementsToTheSuppliedBuilderFunctionInTheOrderPassedToTheBuilder() throws Exception { MultisetBuilder<Integer> multisetBuilder = multisetBuilderWith(3, 1, 2, 3); final Iterable<Integer> expectedElements = iterableWith(3, 1, 2, 3); multisetBuilder.build(new UnaryFunction<Iterable<Integer>, Multiset<Integer>>() { @Override public Multiset<Integer> call(Iterable<Integer> actualElements) { assertThat(listFrom(actualElements), is(listFrom(expectedElements))); return null; } }); }
@Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); } }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }  }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }  static MultisetBuilder<E> multisetBuilder(); static MultisetBuilder<E> multisetBuilder(Class<E> elementClass); @Override Multiset<E> build(); @Override Multiset<E> build(Class<? extends Multiset> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction); }
MultisetBuilder extends AbstractBuilder<E, MultisetBuilder<E>, Multiset<E>> implements AbstractBuilder.WithCustomImplementationSupport<E, Multiset, Multiset<E>> { @Override public Multiset<E> build() { return Multisets.unmodifiableMultiset(HashMultiset.create(elements)); }  static MultisetBuilder<E> multisetBuilder(); static MultisetBuilder<E> multisetBuilder(Class<E> elementClass); @Override Multiset<E> build(); @Override Multiset<E> build(Class<? extends Multiset> implementationClass); @Override T build(UnaryFunction<? super Iterable<E>, ? extends T> builderFunction);  }