December 17, 2018

Using java.util.function.BinaryOperator to create function to return maximum and minimum value in functional programming way

You can read first part of this article here . We all have implemented methods to get maximum or minimum between two different values. A value can be anything, it can be a primitive or an object. It can be an integer or a string or a person object. We were doing this in an […]

Read more
December 16, 2018

How to use and implement apply and andThen functions provided by java.util.function.BinaryOperator in java

java.util.function.BinaryOperator is a Functional Interface, it has only one abstract method. It extends another Functional Interface java.util.function.BiFunction. It inherits apply and andThen methods from BiFunction, and adds two static factory methods maxBy  and minBy. BinaryOperator is special case of BiFunction, where all the parameter types and return type are of the same data-type. This is how the method declaration looks like in […]

Read more