A functional interface is an interface with a single abstract method. Also know as SAM (Single Abstract Method) types.
Examples:
public interface Comparator<T> {
int compare(T o1, T o2);
}
public interface Callable<V> {
V call() throws Exception;
}
public interface ActionListener extends EventListener {
public void actionPerformed(ActionEvent e);
}
public interface Runnable {
public void run();
}
No comments:
Post a Comment