January 7, 2019

Implementing java.util.function.DoubleBinaryOperator in java – functional programming.

DoubleBinaryOperator is a Functional Interface . It has only one abstract method and has no default method, unlike many other functional interfaces. It is a primitive type specialization of BinaryOperator. If we are trying to implement BinaryOperator for a double type, rather than doing that, we can use DoubleBinaryOperator for that. It has only one function. […]

Read more
December 24, 2018

How to use default methods and and or, to compose new BiPredicate implementations from other BiPredicates in java

In BiPredicate Part 1 , we learnt about using test and negate functions. In this article we will use default methods and and or methods to compose BiPredicates, which can perform all the tests of composing BiPredicates. Our use case is to create a system, which helps HR personnel to identify potential candidates for hiring. We will check for three […]

Read more
December 23, 2018

How to use or implement test and negate methods in java.util.function.BiPredicate in java

We have Functional Interfaces in java, which returns a boolean-value after operating on it’s inputs. BiPredicate is one of those Functional interfaces, which returns a boolean value. It has four functions in it’s definition. Three of them are default and one is abstract and it is called test. boolean test( T input1, U input2) :- It returns a […]

Read more
December 10, 2018

How to use java.util.function.Consumer functional interface in java – And different implementations using class, lambdas and method reference

Consumer is present in java.util.functions  package. It is a Functional Interface . In this article, we will use different ways to provide implementations for this interface. The Consumer implementation will take a String-input  and write it to console. The System.out.println  method can be replaced with other writers, like it can modified to write the contents to a file or […]

Read more
November 28, 2018

What is lambdas in Java – Understanding Lamdas in Java

Lambdas were introduced in Java 8. For me they are first step towards functional programming in java. Lambdas are a little like anonymous class. They are similar in the way they are defined and passed around as a parameter in functions. But, lambdas are not exactly an anonymous class. After compilation, an anonymous class has […]

Read more