美文网首页
System.out.println(f.factoril.ap

System.out.println(f.factoril.ap

作者: 哈迪斯Java | 来源:发表于2023-04-02 15:21 被阅读0次

    import java.util.function.Function;

    public class Factoril {
    Function<Long, Long> factoril = n -> {
    long result = 1;
    for (int i = 1; i <= n; i++) {
    result *= i;
    }
    return result;
    };

    public static void main(String[] args) {
        Factoril f = new Factoril();
        System.out.println(f.factoril.apply((long) 11));
    }
    

    }
    import java.util.List;
    import java.util.stream.Collectors;

    public class AvgAgeDemo {

    public static void main(String[] args) {
        List<Employee> list = Employee.getEmpList(); // 获取公共类的测试数据
        double avgAge = list.stream().collect(Collectors.averagingDouble(Employee::getAge));
        list.stream().filter(people -> people.getAge() > avgAge).forEach(e -> System.out.println(e));
    }
    

    }

    相关文章

      网友评论

          本文标题:System.out.println(f.factoril.ap

          本文链接:https://www.haomeiwen.com/subject/mcihddtx.html