Higher Order Functions in Java
I started my career as a Java developer back in 2011. I developed most of my code in the 1.7 version of Java. Around 2014, I switched to full-time Scala and have not programmed in Java ever since.
Java used to be a slow-moving language that had started lagging behind the other languages. Scala kind of filled that gap of modern language on a JVM. But in the last few years, it has changed. There is a new version of Java every 6 months and it has been getting new features at a very rapid pace. So I thought it will be interesting to go back to Java now and see how it has evolved compared to Java 7.
So in this series of posts, I will be talking about new features of Java from a Scala developer’s point of view. I will be using?Java 17, the latest LTS version, for these examples.
This is the fourth post in the series where I will discuss the higher-order functions. You can find all the posts in the series?here.
Higher Ordered Functions
A higher-order function is a function, that can take another function as an input or return a function. Higher order functions are the cornerstone of functional programming in any language.
In this post, we will discuss how Java lambda expressions can be used in higher order functions context.