grouping by のメモ
Map<String, Long> countmap = authors.stream().collect(Collectors.groupingBy(t->t.level, Collectors.counting())); Map<String, List<Author>> mapAuthors = authors.stream().collect(Collectors.groupingBy(t->t.level, Collectors.mapping(u->u, Collectors.toList())));
Stream の grouping by は、chunk リストを作るの役立つ
AtomicInteger を利用して、3個ずつに分けたリストのコレクションを生成
AtomicInteger counter = new AtomicInteger(); Collection<List<Author>> chunklist = authors.stream().collect(Collectors.groupingBy(t->counter.getAndIncrement() / 3 , Collectors.mapping(u->u, Collectors.toList()))).values();