BiConsumer is a Functional Interface . It has two methods, one abstract and other one is default method. void accept(T parameter1, U parameter2) :- It accepts two parameters and does not return anything. default BiConsumer<T, U> andThen(BiConsumer< ? super T, ? super U> applyThisAfterProcessing) :- This function takes one BiConsumer and returns another BiConsumer .The BiConsumer , which is passed in as an argument […]
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 […]