Functional API
Functional interfaces provide target types for lambda expressions and method references.
There are base interfaces.
- The Supplier interface allows provide some values. (see list of suppliers)
- The Function interface allows to accept one argument and produce a result. (see list of functions)
- Operators are specialization of Function interface, when argument(s) and result have same type. (see list of operators)
- The Predicate interface allows to return a boolean value from an argument value, used to test values. (see list of predicates)
- The Consumer interface represents an operation that accepts a single input argument and returns no result. Unlike most other functional interfaces, Consumer is expected to operate via side-effects. (see list of consumers)
suppliers
interface | description |
---|---|
Supplier | Represents a supplier of results. |
BooleanSupplier | Represents a supplier of boolean-valued results. |
IntSupplier | Represents a supplier of int-valued results. |
LongSupplier | Represents a supplier of long-valued results. |
DoubleSupplier | Represents a supplier of double-valued results. |
functions
interface | description |
---|---|
Function | Represents a function that accepts one argument and produces a result. |
IntFunction | Represents a function that accepts an int-valued argument and produces a result. |
LongFunction | Represents a function that accepts an long-valued argument and produces a result. |
DoubleFunction | Represents a function that accepts an double-valued argument and produces a result. |
ToIntFunction | Represents a function that produces an int-valued result. |
ToLongFunction | Represents a function that produces an long-valued result. |
ToDoubleFunction | Represents a function that produces an double-valued result. |
IntToLongFunction | Represents a function that accepts a int-valued argument and produces an long-valued result. |
IntToDoubleFunction | Represents a function that accepts a int-valued argument and produces an double-valued result. |
LongToIntFunction | Represents a function that accepts a long-valued argument and produces an int-valued result. |
LongToDoubleFunction | Represents a function that accepts a long-valued argument and produces an double-valued result. |
DoubleToIntFunction | Represents a function that accepts a double-valued argument and produces an int-valued result. |
DoubleToLongFunction | Represents a function that accepts a double-valued argument and produces an long-valued result. |
BiFunction | Represents a function that accepts two arguments and produces a result. |
ToIntBiFunction | Represents a function that accepts two arguments and produces a int-valued result. |
ToLongBiFunction | Represents a function that accepts two arguments and produces a long-valued result. |
ToDoubleBiFunction | Represents a function that accepts two arguments and produces a double-valued result. |
operators
interface | description |
---|---|
UnaryOperator | Represents an operation on a single operand that produces a result of the same type as its operand. |
IntUnaryOperator | Represents an operation on a single int-valued operand that produces an int-valued result. |
LongUnaryOperator | Represents an operation on a single long-valued operand that produces an long-valued result. |
DoubleUnaryOperator | Represents an operation on a single double-valued operand that produces an double-valued result. |
BinaryOperator | Represents an operation upon two operands of the same type, producing a result of the same type as the operands. |
IntBinaryOperator | Represents an operation upon two int-valued operands and producing an int-valued result. |
LongBinaryOperator | Represents an operation upon two long-valued operands and producing an long-valued result. |
DoubleBinaryOperator | Represents an operation upon two double-valued operands and producing an double-valued result. |
predicates
interface | description |
---|---|
Predicate | Represents a predicate of one argument. |
IntPredicate | Represents a predicate of one int-valued argument. |
LongPredicate | Represents a predicate of one long-valued argument. |
DoublePredicate | Represents a predicate of one double-valued argument. |
BiPredicate | Represents a predicate of two arguments. |
consumers
interface | description |
---|---|
Consumer | Represents an operation that accepts a single input argument and returns no result. |
DoubleConsumer | Represents an operation that accepts a single double-valued argument and returns no result. |
IntConsumer | Represents an operation that accepts a single int-valued argument and returns no result. |
LongConsumer | Represents an operation that accepts a single long-valued argument and returns no result. |
BiConsumer | Represents an operation that accepts two input arguments and returns no result. |
ObjDoubleConsumer | Represents an operation that accepts an object-valued and a double-valued argument, and returns no result. |
ObjIntConsumer | Represents an operation that accepts an object-valued and a int-valued argument, and returns no result. |
ObjLongConsumer | Represents an operation that accepts an object-valued and a long-valued argument, and returns no result. |