|
Answer» There are several changes in Collections Framework in Java 8 mostly influenced by the inclusion of LAMBDA expression in Java 8 -
- STREAM API - Stream can be obtained for Collection via the stream() and parallelStream() methods;
As exp if you have a list of cities in a List and you want to remove the duplicate cities from that list it can be done as cityList = cityList.stream().distinct().collect(Collectors.toList());
- ForEach loop which can be used with Collection. Spliterators which are helpful in PARALLEL processing where several threads can itearate/process part of the collection.
- New methods are added to Collections like replaceAll, getOrDefault, putIfAbsent in Map.
- HashMap, LinkedHashMap and ConcurrentHashMap.implementation is changed to reduce hash collisions. Instead of linked list a balanced tree is used to store the ENTRIES after a CERTAIN threshold is reached.
There are several changes in Collections Framework in Java 8 mostly influenced by the inclusion of Lambda expression in Java 8 -
|