Java 8 introduces the @FunctionalInterface annotation to denote any interface that has exactly one abstract method as a functional interface. One of the reasons for introducing it is to tell the user (programmer) that the lambda expression can be used in the context of a functional interface.
The Comparator interface is annotated using @FunctionalInterface . But two methods are abstract.
int compare(T o1, T o2);
and
boolean equals(Object obj);
In FunctionalInterface docs, it is explicitly referred to as
A conceptually functional interface has exactly one abstract method.
Isn't the equals method considered abstract here?
source share