الأربعاء، 9 يناير 2019

Java 8 BiConsumer | Examples of BiConsumer accept and andThen methods

BiConsumer is a functional interface which is part of java.util.function widely used with collection api.

Package java.util.function is introduced in Java 8.



BiConsumer has two methods in it.


1) void accept(T t, U u)
2) BiConsumer<T,U>     andThen(BiConsumer<? super T,? super U> after)


accept() method is an abstract method and andThen() is a default method.

In this post, we will see how to use BiConsumer interface with examples. Please post your quires in the comment section.