I am trying to learn java - stream. I am able to do simple iteration / filter / map / collection etc.
When I was kind of trying to collect every 3 elements and print
If you have Guava in your project, you can use Iterables.partition method:
Iterables.partition
import com.google.common.collect.Iterables; import com.google.common.collect.Streams; ... Stream> stream = Streams.stream(Iterables.partition(list, 3));