Supplier Functional Interface Example

Java 8 added a new functional interface named “Supplier”. The purpose of this interface is to supply instances. I will be explaining using the below example. In the example I have want of list of employees. I will separate the logic behind employee instance creation and adding to list. The employee instance will be created…… Continue reading Supplier Functional Interface Example

Consumer Functional Interface Example

Java 8 added a new functional interface named “Consumer”. The purpose of this interface is to consume/process the information received, it doesn’t return anything. I will be explaining using the below example. In the example I have list of employees whom I want to terminate. I will pass the list of employees to an implementation…… Continue reading Consumer Functional Interface Example

BiPredicate Simple Example

This post explains BiPredicate functional interface. BiPredicate is similar to Predicate functional interface except BiPredicate takes two arguments instead of one. In the below example we will filter list of Person entities based on first and last name. The predicate class name will be “NamePredicate”. NamePredicate package Function; import java.util.function.BiPredicate; public class NamePredicate implements BiPredicate…… Continue reading BiPredicate Simple Example