Comprehensive list of all functional interfaces in JDK outside java.function package

215 views Asked by At

The java.function package contains many functional interfaces introduced in Java 8 that are extensively used in the Streams API.

But I know for a fact that by definition there are potentially many other functional interfaces that either

  • already existed before Java 8 but now are considered functional because they comply with the definition of a functional interface (having a single abstract method)
  • where introduced in Java 8 in other packages besides java.function

Examples of the first type are Runnable, ActionLIstener and Comparator.

How can I obtain a comprehensive list of all functional interfaces that exist in the Java JDK whether or not they're annotated as @FunctionalInterface

  • Is there a programmatic way to get it?
  • How can I programmatically produce a list of all interfaces in the JDK that have only one abstract method (even if they have default or static ones)
  • There exist such a list?
0

There are 0 answers