Reputation: 1043
If the compiler can figure out the type of the method with only one parameter, why it is not able to do the same for methods with two parameters or more tacking acount the order of parameters ?
Here an example :
In another way, Why the compile can't figure out that str is a String (First parameter in the unique method, and also str2 is a String (second parameter in the unique method) ?
Upvotes: 2
Views: 105
Reputation: 120978
It seems you are not defining this correctly:
(str, str2) -> str.length()
You should also receive a compile time error for the second example.
Upvotes: 4