📄️ Functional Programming
Background:
📄️ Lambda Expressions
Introduction:
📄️ Streams
A stream in Java is not a data structure but rather a sequence of elements that can be processed in parallel or sequentially. It is an abstraction that allows developers to express computations over data in a functional and declarative manner. Unlike collections, which are concrete data structures that store elements, streams focus on describing the desired computation on the data.
📄️ Default Methods
In Java, interfaces traditionally declared abstract methods that had to be implemented by any class implementing the interface. With the introduction of default methods, interfaces can now provide default implementations for certain methods. This allows existing interfaces to evolve without breaking the classes that implement them.
📄️ Method References
Method references are a shorthand notation to refer to methods or constructors using the :: operator. They provide a way to make your code more concise by replacing certain lambda expressions with a reference to an existing method.
📄️ Functional Interfaces
A functional interface is an interface that contains exactly one abstract method. It may also contain multiple default or static methods, but as long as it has only one abstract method, it qualifies as a functional interface. Functional interfaces enable the use of lambda expressions, allowing for the concise representation of single-method interfaces.
📄️ Optional
What is Optional?
📄️ For-Each, Map, Filter, Reduce
forEach:
📄️ Common Functional Interface and Streams
1. Function