@Test public void shouldAddElementsToAMultisetOfTheSpecifiedImplementationInTheOrderTheyWereSuppliedToTheBuilder() throws Exception { List<Integer> expectedEntries = listWith(4, 3, 4); MultisetBuilder<Integer> multisetBuilder = multisetBuilderWith(4, 3) .and(4); NaiveMultiset<Integer> actual = (NaiveMultiset<Integer>) multisetBuilder.build(NaiveMultiset.class); List<Integer> actualEntries = listFrom(actual); assertThat(actualEntries, is(expectedEntries)); }
@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);  }