I have very large stream of objects. I read them from DB (in streaming mode of course) and return to user via REST in streaming mode (to avoid memory consumption).
I'd like to have them grouped (10 in group i.e.) during processing but still be represented by stream.
Something like:
Stream<Obj> -> Stream<List<Obj>> -> REST response
I dont want to group them with Collectors producing Map or List, I still want them as a stream to lower memory usage.
Are the Collectors my choice or what should I try? The best is to stay on the edge of Java 8 stream feature.
>. I work with simple Java Plain Objects.
– odiszapc Feb 25 '16 at 13:53