@Test public void shouldConvertTheSuppliedIteratorToAMultiset() { List<String> elements = listWith("a", "a", "c", "d"); Multiset<String> expectedMultiset = multisetWith("a", "a", "c", "d"); Multiset<String> actualMultiset = asMultiset(elements.iterator()); assertThat(actualMultiset, is(expectedMultiset)); }
public static <T> Multiset<T> asMultiset(Iterator<? extends T> iterator) { return HashMultiset.create(asList(iterator)); }
Iterators { public static <T> Multiset<T> asMultiset(Iterator<? extends T> iterator) { return HashMultiset.create(asList(iterator)); } }
Iterators { public static <T> Multiset<T> asMultiset(Iterator<? extends T> iterator) { return HashMultiset.create(asList(iterator)); } private  Iterators(); }
Iterators { public static <T> Multiset<T> asMultiset(Iterator<? extends T> iterator) { return HashMultiset.create(asList(iterator)); } private  Iterators(); static Iterator<T> emptyIterator(); static Iterable<T> asIterable(Iterator<T> iterator); static List<T> asList(Iterator<? extends T> iterator); static Set<T> asSet(Iterator<? extends T> iterator); static Multiset<T> asMultiset(Iterator<? extends T> iterator); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(Class<T> ofKlass); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(Class<T> ofKlass); }
Iterators { public static <T> Multiset<T> asMultiset(Iterator<? extends T> iterator) { return HashMultiset.create(asList(iterator)); } private  Iterators(); static Iterator<T> emptyIterator(); static Iterable<T> asIterable(Iterator<T> iterator); static List<T> asList(Iterator<? extends T> iterator); static Set<T> asSet(Iterator<? extends T> iterator); static Multiset<T> asMultiset(Iterator<? extends T> iterator); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(); static UnaryFunction<? super Iterable<? extends T>, Iterator<? extends T>> fromIterableToIterator(Class<T> ofKlass); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(); static UnaryFunction<Iterable<? extends T>, Iterator<? extends T>> fromIterableToIteratorKeepingNull(Class<T> ofKlass);  }