This is a six-minute glipse of functional programming using Java.
Starting with Java 8, we can enhance our Java code solutions with functional approaches. But, what exactly does Java provide? Let’s take a look. Functional programming is a programming paradigm where the focus is on “what to solve” in contrast to a procedural paradigm where the main focus is “how to solve.” In other words, functional programming is a declarative paradigm. The core of Functional Programming is to solve computational problems as an evaluation of mathematical functions. Yes, functions, these relationships associate elements of a set X (inputs) to a single element of a set Y (output). In functional programming, functions are everywhere. Functions can be stored in a variable. Functions can be passed as a parameter. Functions can receive functions as parameters or even return a function as results. Moreover, functions can be expressions (the instructions inside methods, such as 2+2, which is an arithmetic expression) 👀.