@Test
public void aggregateInPlaceByWithBatchSize()
{

    Procedure2<AtomicInteger, Integer> sumAggregator = new Procedure2<AtomicInteger, Integer>()
    {
        public void value(AtomicInteger aggregate, Integer value)
        {
            aggregate.addAndGet(value);
        }
    };
    MutableList<Integer> list = LazyIterate.adapt(Collections.nCopies(100, 1))
            .concatenate(Collections.nCopies(200, 2))
            .concatenate(Collections.nCopies(300, 3))
            .toList()
            .shuffleThis();
    MapIterable<String, AtomicInteger> aggregation =
            FJIterate.aggregateInPlaceBy(list, Functions.getToString(), ATOMIC_INTEGER_NEW, sumAggregator, 50);
    Assert.assertEquals(100, aggregation.get("1").intValue());
    Assert.assertEquals(400, aggregation.get("2").intValue());
    Assert.assertEquals(900, aggregation.get("3").intValue());
}