To Stream

or not to Stream

java.util.stream.Stream<T>

  • Asynchronous vs Multi threaded
     
  • Pull vs Push​
     
  • Stream pipeline
  1. data source
     
  2. intermediate operations (stateless or statefull)
     
  3. terminating operation

Behavioral parameters must be non-interfering

java.util.stream.Stream<T>

  • Asynchronous vs Multi threaded
     
  • Pull vs Push​
     
  • Stream pipeline:

should I use Java Streams?

1TB @ 2018

5MB @ 1956

live demo

The best approach is to avoid stateful behavioral parameters to stream operations entirely; there is usually a way to restructure the stream pipeline to avoid statefulness.

To Stream or not to Stream?

I use Java Streams all the time...

Made with Slides.com