Lambda expressions do not have a built-in type; following error message:
Object lambda = x -> x;
Lambda expressions are poly expressions that are expressions whose type depends on their context. In particular, a lambda expression derives its type from its target type, which should be a functional interface - an interface with a single (non Object) abstract method. The same lambda expression can have several types, depending on its target type:
Predicate<String> isEmpty = s -> s.isEmpty();
Function<String, Boolean> isEmpty = s -> s.isEmpty();
Function ; , Runnable Predicate Comparable. , , Function, - .
, Function; . Lambdas ( refs) .