public static void main(String arg[]) {
final AtomicInteger counter = new AtomicInteger(0);
List<Integer> questionsList = new ArrayList<>();
for(Integer i=0;i<100;i++) {
questionsList.add(i*2);
}
final Collection<List<Integer>> dividedByTenList = questionsList.stream()
.collect(Collectors.groupingBy(it -> counter.getAndIncrement() / 10))
.values();
dividedByTenList.forEach(batchlist -> {
System.out.println("hello pawan"+batchlist);
});
}
No comments:
Post a Comment