Which methods are being used as an abstract method for functional interface?
Looking under the java built in interface,
As of what I understand, functional interface may only take one abstract method to be implemented, but how does it know which method is needed to be implemented during an anonymous class/lambda calls?
My logic is that Comparator takes generic
Comparator<T> functional interface has 2 non default methods, int compare(T o1, T o2) and boolean equals(Object obj). My question is asking the reason of why the latter method does not need to be implemented when using lambda/anonymous, what determines which method is being used as the functional method within the interface.As of what I understand, functional interface may only take one abstract method to be implemented, but how does it know which method is needed to be implemented during an anonymous class/lambda calls?
My logic is that Comparator takes generic
T, so that it find the following abstract method that uses T as the parameters, such as int compare(T o1, T o2). OR in another case, because of the order of method declaration.