Posts

Showing posts from June, 2020

Java - Java 8 Stream Tutorial

Repost from  https://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/ This example-driven tutorial gives an in-depth overview about Java 8 streams. When I first read about the  Stream  API, I was confused about the name since it sounds similar to  InputStream  and  OutputStream  from Java I/O. But Java 8 streams are a completely different thing. Streams are  Monads , thus playing a big part in bringing  functional programming  to Java: In functional programming, a monad is a structure that represents computations defined as sequences of steps. A type with a monad structure defines what it means to chain operations, or nest functions of that type together. This guide teaches you how to work with Java 8 streams and how to use the different kind of available stream operations. You'll learn about the processing order and how the ordering of stream operations affect runtime performance. The more powerful stream operation...