@Test public void aggregateInPlaceByWithBatchSize() { MutableList<Integer> list = LazyIterate.adapt(Collections.nCopies(1000, 1)) .concatenate(Collections.nCopies(2000, 2)) .concatenate(Collections.nCopies(3000, 3)) .toList() .shuffleThis(); MapIterable<String, AtomicInteger> aggregation = ParallelIterate.aggregateInPlaceBy( list, String::valueOf, ATOMIC_INTEGER_NEW, AtomicInteger::addAndGet, 100); Assert.assertEquals(1000, aggregation.get("1").intValue()); Assert.assertEquals(4000, aggregation.get("2").intValue()); Assert.assertEquals(9000, aggregation.get("3").intValue()); }
public LazyIterable<T> asLazy() { return LazyIterate.adapt(this); }
public RichIterable<V> valuesView() { return LazyIterate.empty(); }
public RichIterable<Pair<K, V>> keyValuesView() { return LazyIterate.empty(); }
public RichIterable<K> keysView() { return LazyIterate.empty(); }
public RichIterable<Pair<K, V>> keyValuesView() { return LazyIterate.adapt(this.entrySet()) .collect(AbstractImmutableEntry.<K, V>getPairFunction()); }
@Override public RichIterable<V> valuesView() { return LazyIterate.adapt(this.values()); }
@Override public RichIterable<K> keysView() { return LazyIterate.adapt(this.keySet()); }
@Override protected <T> LazyIterable<T> newWith(T... elements) { return LazyIterate.drop(FastList.newListWith(elements), 0); }