February 10, 2019

How to implement java.util.function.DoubleToLongFunction

java.util.function.DoubleToLongFunction is a primitive specialization of Other Functional Interfaces. What it means is , we can get the same functionality using other functional interfaces, but they are going to be slow. Because of boxing and unboxing. If you are dealing with Double and Long wrapper objects then use other functional interface. So, this functional interface is […]

Read more
January 26, 2019

What are effective final variables in java, and where we can use it.

There is a final keyword, which is used to make a reference value permanent. It means – the value can not be changed once defined. Then there is effective final variable. These variables are not declared final. But, depending on the context they can be considered as final. What do i mean from a context? you should […]

Read more
January 26, 2019

Create a complete binary tree from an array of data in java

Note :- Using java 8 and above. Hi there… Today, I am going to write a java program which will take an var-arg of character, you can use any data-type you want. Data type is not the focus here. The main focus is the  process of creating a binary tree. I am using functional programming to do […]

Read more
January 21, 2019

How to implement java.util.function.DoubleToIntFunction in java

java.util.function.DoubleToIntFunction is a Functional Interface. It has only one method, and that is an abstract method. This abstract method is declared to accept one double value as an input-parameter, and it returns an int value. Both, input and output are primitives. These classes are specialized versions for primitive. As JVM doesn’t need to do boxing and unboxing. […]

Read more
January 19, 2019

Implement java.util.function.DoubleSupplier to return random numbers – java 11 and above

java.util.function.DoubleFunction is a Functional Interface. It has one abstract method, which takes no input but returns a double value. It can be used as a supplier of double values, and it can be used to create a doublestream double getAsDouble() :- it returns a double value, that’s all it’s declaration says. In this article, we will write an […]

Read more
January 18, 2019

How to Implement java.util.function.DoublePredicate’s function – test, and, or and negate in java

This code should run in java 11 and above. It definitely needs – above java 8. Few things will work in java 9 or 10. But, code should successfully run in java 11 and above. Because, I am running java 11. So, In this episode of java wonderland, we are going to implement java.util.function.BinaryPredicate.  Those who […]

Read more
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 25, 2018

Creating a boolean switch using BooleanSupplier, which alternatively returns true and false.

In this article, we will create a BooleanSupplier implementation, which returns true or false value on the alternate basis. If it returns true on current call, then it will return a false on the next call and a true on the next to next call, and this will go on. This is a very simple […]

Read more
December 25, 2018

Providing implementation for getAsBoolean in BooleanSupplier – a functional interface – in java

If you don’t know about Functional Inteface then you can read about it, in the provided link. Now coming to BooleanSupplier, it is a functional interface. It has only one abstract method. boolean getAsBoolean() :- it returns a boolean value and has no input parameters. It can be used to provide streams of boolean values. Implementation 1 […]

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