If I wrote the Predicate
interface, I\'d want to encode in the interface the fact that it\'s just a function that returns a primitive boolean
, like thi
In my opinion Function
is just the definition of a generic function. If all FunctionalInterfaces
would implement Function
, the only abstract method would have to be named apply()
. In the context of a concrete FunctionalInterface
like FilterFile
, the abstract method boolean accept(File pathname)
is a much better name then Boolean apply(File)
.
The annotation @FunctionalInterface
already marks an interface as being intended to be usable as a FunctionalInterface
. There is no benefit having them all implement a base interface other then processing them in a generic way. I do not see when you would not care about the semantics of a FunctionalInterface
in advance to make them available to call apply
for them all.