- Selenium WebDriver Quick Start Guide
- Pinakin Chaubal
- 153字
- 2021-06-24 18:26:24
Functional interfaces
Functional interfaces contain one—and only one—abstract method. An abstract method is one which should have a body in the implementation class if the implementation class is not abstract. It can have any number of regular methods (methods which have a body in the implementation classes), but the prerequisite of a functional interface is that the number of abstract methods must be only one. These interfaces are used hand-in-hand with Lambda expressions.
In the following code block, the demo method is inside an interface Greeting. Therefore, this interface should only have one abstract method, which is the demo method. In order to instruct other users that this is a functional interface, we annotate this interface with the @FunctionalInterface annotation.
The type of blockofCodeA will be of this functional interface type. This annotation is optional:
@FunctionalInterface
public interface Greeting {
public void demo();
}
- PLC控制程序精編108例
- Designing Purpose:Built Drones for Ardupilot Pixhawk 2.1
- Getting Started with oVirt 3.3
- Mobile-first Bootstrap
- VMware Horizon View 6 Desktop Virtualization Cookbook
- Instant Handlebars.js
- 網絡操作系統管理與應用(第三版)
- Linux系統安全基礎:二進制代碼安全性分析基礎與實踐
- 巧學活用Windows 7
- Mobile First Design with HTML5 and CSS3
- Application Development in iOS 7
- Linux命令行大全(第2版)
- Learn CUDA Programming
- Linux操作系統
- 從實踐中學習Windows滲透測試