Java8 ~ 特性

Java8 特性1 

函数式编程

  将方法和lambda作为一等值;

  在没有可变共享状态时,函数或方法可以有效、安全的并行执行。

  

行为参数化

  行为参数化可以帮助处理频繁变更的需求的一种软件开发模式。

  让方法接受多种行为作为参数,并在内部使用,来完成不同的行为。

  将方法的行为参数化了。
  行为参数化的好处在于可以将迭代要筛选的集合的逻辑与集合中每个元素应用的行为区分开来。

  多种行为,一个参数

软件工程原则 DRY (Don't Repeat YouSelf)

Lambda

lists.sort(Comparator.comparing(User::getAge));
Thread thread = new Thread(() -> System.out.println("123"));

猜你喜欢

转载自www.cnblogs.com/BillyYoung/p/11352775.html