Consumer Functional Interface
This lesson explains the basics of Consumer functional interfaces.
We'll cover the following
Consumers
are functional interfaces that take in a parameter and do not produce anything.
Below are some of the functional interfaces which can be categorized as Consumers.
Consumer<T> |
Represents an operation that accepts a single (reference type) input argument and returns no result | void accept(T t) |
DoubleConsumer |
Accepts a single double-value argument and returns no result | void accept(double value) |
IntConsumer |
Accepts a single int-value argument and returns no result | void accept(int value) |
LongConsumer |
Accepts a single long-value argument and returns no result | void accept(long value) |
BiConsumer<T, U> |
Represents an operation that accepts two (reference type) input arguments and returns no result | void accept(T t, U u) |
ObjDoubleConsumer<T> |
Accepts an object-value and a double-value argument, and returns no result | void accept(T t, double value) |
ObjIntConsumer<T> |
Accepts an object-value and an int-value argument, and returns no result | void accept(T t, int value) |
ObjLongConsumer<T> |
Accepts an object-value and a long-value argument, and returns no result | void accept(T t, long value) |
Get hands-on with 1400+ tech skills courses.