在Java8中,对集合中方法有变动的类有以下几个:

  1. List接口:新增了sort()和replaceAll()方法。

  2. Map接口:新增了forEach()、replace()、replaceAll()、compute()、merge()等方法。

  3. Set接口:新增了forEach()、removeIf()等方法。

  4. Collection接口:新增了stream()、parallelStream()、forEach()、removeIf()等方法。

  5. Arrays类:新增了parallelSort()、setAll()、parallelSetAll()等方法。

  6. Comparator接口:新增了comparing()、thenComparing()、reversed()等方法。

  7. Iterator接口:新增了forEachRemaining()方法。

  8. Stream接口:新增了filter()、map()、flatMap()、reduce()、collect()等方法。

  9. ConcurrentHashMap类:新增了forEach()、search()、reduce()等方法。

  10. Optional类:新增了ifPresent()、orElse()、orElseGet()、orElseThrow()等方法

java8中对集合中方法有变动的类有哪些

原文地址: https://www.cveoy.top/t/topic/ccuL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录