Consumer and BiConsumer Functional Interface - JAVA 8
Consumer and BiConsumer Functional Interface Consumer<T> is an in-built functional interface introduced in Java 8 in the java.util.function package. It can be used in all contexts where an object needs to be consumed, i.e. taken as input, and some operation is to be performed on the object without returning any result . Common example of such an operation is printing where an object is taken as input to the printing function and the value of the object is printed . The functional method of Consumer is accept(T t). @FunctionalInterface Public interface Consume<T, > { …} Here is a simple source code of java.util.function.Consumer package java.util.function; import java.util.Objects; @FunctionalInterface public interface Function<T> { public void accept(T t); } Where accept (T t) is an abstract method where T is the type of the...