curric

View on GitHub

./curric/Functional-Programming/Java-Streams/

Java Streams ( the functional API for Java Collections )

Java Streams is an API that applies a specific action (filter, map, or reduce) over the entire collection. After applying the specific action, a new modified collection is returned, allowing for method chaining (do operators one after another)

  // Example of Chaining
  originalCollection.firstMethod().secondMethod().finalMethod()
  
  // syntax guidelines state to put a newline 
  // before every new method call for readability 
  originalCollection
      .firstMethod()
      .secondMethod()
      .finalMethod()

Types of Streams

Reference to Oracle Docs for Streams