The Consumer Interface is a part of the java.util.function package which has been introduced in Java 8, to implement functional programming in Java. It represents a function which takes in one argument and produces a result. However these kind of functions don’t return any value.
- Consumer Functional Interface contains one abstract method accept.
- Sometimes our requirment is we have to provide some input value, perform certain operation.
- But not required to return anything,then we should go for Consumer.i.e Consumer can be used to consume object and perform certain operation.
- Consumer interface contain one abstract method is accept().
- Consumer Functional Interface contains default method andThen().
0 Comment to "Consumer Interface"
Post a Comment