10.10.3 Functional Interfaces
As of Java SE 8, any interface containing only one abstract method is known as a functional interface. There are many such interfaces throughout the Java SE 7 APIs, and many new ones in Java SE 8. Some functional interfaces that you’ll use in this book include:
• ActionListener (Chapter 12)—You’ll implement this interface to define a method that’s called when the user clicks a button.
• Comparator (Chapter 16)—You’ll implement this interface to define a method that can compare two objects of a given type to determine whether the first object is less than, equal to or greater than the second.
• Runnable (Chapter 23)—You’ll implement this interface to define a task that may be run in parallel with other parts of your ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access