I am currently reading Java 8 Lambda expressions. I learnt that,
- Lambda expressions can operate only on functional interfaces (i.e. interface with only one abstract method).
I also learnt that,
- Signature of lambda expression is decided by signature of that one abstract method.
My question is, if we have 2 methods in an interface which are different in types of input parameters and no. of input parameters, why can't lambda expression deduce its signature from either of the method ? After all, its just need to find type of input parameters of the function, isn't it ? Why the restriction of only one method is put by Java 8 creators ?
Edit: The answer at this link as commented by Ousmane Mahy Diaw does not really answer, why 2 methods in the functional inteface are not allowed. The answer just say, its a requirement of Lambda expression to have functional interface only one method.