I have a list of items, say..
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
What I want is to have lists of size 3
[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14]]
How to do this with java streams?
list.stream()
.reduce( /* what do I do here? */ )
.forEach( l -> /* l.size() == 3 */);