I\'m reading a chapter on lambdas in Herbert Schildt\'s \"Java: The Complete Reference\" and there are quite a few references to \"lambda target type\" and \"target type context
One of the definitions of "target" (taken from here) is:
a result or situation that you intend to achieve.
You can say the result a lambda expression intends to achieve is to implement some functional interface. Hence that functional interface can be seen as the target of that lambda expression, and the type of the functional interface is the target type.
Hence the target type is the type of the functional interface implemented by the lambda expression.
The target type can be inferred based on the context in which the lambda expression is used:
In
(int n) -> n % 2 == 0
the target type is unknown. If you assign this expression to some functional interface reference, that would be the target type.
In
MyInterface myInt = () -> { return "123"; }
the target type is MyInterface
.