Comparable and Comparator are Functional Interface and Comparator is declared as @FunctionalInterface also but why Comparable is not declared as @FunctionalInterface in jdk 1.8 though it is one of them?
Asked
Active
Viewed 1,401 times
1 Answers
6
Comparable
is technically a functional interface, but it makes no sense to actually implement it with a lambda. Comparable
objects really have to have other state that you're trying to compare, and you're supposed to compare two objects of the same type. Neither of those make sense for a lambda.

Louis Wasserman
- 191,574
- 25
- 345
- 413
-
Yeah it makes sense. Thank you for your clearification. – iamgul Sep 25 '18 at 10:30