Interface
@FunctionalInterface
public interface Action {
void execute();
}
存储与调用
public static void main(String[] args) {
HashMap<String, Action> map = new HashMap<>();
map.put("a", () -> System.out.println("aaa"));
map.put("b", () -> System.out.println("bbb"));
map.get("a").execute();
}