Functional Programming in JAVA
JAVA 8 release is the package of all surprises, functional programming is one among them. Let's explore a bit on functional programming style in java... Functional programming is the natural successor to Object Oriented programming.The objective of the design of the FPL is to mimic mathematical functions to the greatest extent possible. Will start with examples for functional programming in java Normally if we want to write any functions say addition of two numbers we were following below approach: public int add(int x,int y) { return x+y; } The above piece of code can be written in FP style like Function<Integer,Integer> adder = (x,y)->x+y; Where Function belongs to the package java.util.function General prototype java.util.function.Function<T,R> where T is input datatype, R is return data type. Java has one more Interface called BinaryOperator under java.util.function which ...