java8中对集合中方法有变动的类有哪些
在Java8中,对集合中方法有变动的类有以下几个:
-
List接口:新增了sort()和replaceAll()方法。
-
Map接口:新增了forEach()、replace()、replaceAll()、compute()、merge()等方法。
-
Set接口:新增了forEach()、removeIf()等方法。
-
Collection接口:新增了stream()、parallelStream()、forEach()、removeIf()等方法。
-
Arrays类:新增了parallelSort()、setAll()、parallelSetAll()等方法。
-
Comparator接口:新增了comparing()、thenComparing()、reversed()等方法。
-
Iterator接口:新增了forEachRemaining()方法。
-
Stream接口:新增了filter()、map()、flatMap()、reduce()、collect()等方法。
-
ConcurrentHashMap类:新增了forEach()、search()、reduce()等方法。
-
Optional类:新增了ifPresent()、orElse()、orElseGet()、orElseThrow()等方法
原文地址: https://www.cveoy.top/t/topic/ccuL 著作权归作者所有。请勿转载和采集!