Lambda 表达式需要“函数式接口”的支持
    函数式接口:接口中只有一个抽象方法的接口,称为函数式接口。 可以使用注解 @FunctionalInterface 修饰可以检查是否是函数式接口

    1. /* 二、Lambda 表达式需要“函数式接口”的支持
    2. 函数式接口:接口中只有一个抽象方法的接口,称为函数式接口。 可以使用注解 @FunctionalInterface 修饰
    3. 可以检查是否是函数式接口*/
    4. @Test
    5. public void ceui6() {
    6. Integer operation = operation(100, (x) -> x * x);
    7. System.out.println(operation); // 10000
    8. System.out.println("-------------------------");
    9. Integer operation1 = operation(100, (x) -> x + 200);
    10. System.out.println(operation1);// 300
    11. }
    12. public Integer operation(int a, MyFun mf) {
    13. return mf.getValue(a);
    14. }