1

I understand, that multiple abstract methods in functional interfaces wouldn't work, as the compiler cannot know which abstract method to use when the lambda expression is declared. I've also come to know, that additional abstract method signatures may be declared in a functional interface, if they match the ones of the default Object class:

A functional interface is an interface that has just one abstract method (aside from the methods of Object), and thus represents a single function contract.

Source: Java Language Specification)

I still cannot figure out, however, why an interface should ever declare such abstract methods like boolean equals(Object o) in a functional interface (or any other interface) and why this exception was made in the spec for functional interfaces. What is the point of declaring such abstract methods, which exist always anyway?

MattDiMu
  • 4,873
  • 1
  • 19
  • 29

0 Answers0