Documentation Contents

Collections Framework Enhancements in Java SE 8

Support for Lambda Expressions, Streams, and Aggregate Operations

The Java Collections Framework has been updated to support lambda expressions, streams, and aggregate operations. For more information on these topics, see the following pages:

Performance Improvement for HashMaps with Key Collisions

As part of the work for JEP 180, there is a performance improvement for HashMap objects where there are lots of collisions in the keys.

The alternative String hash function added in 7u6 has been removed from JDK 8, along with the jdk.map.althashing.threshold system property. Instead, hash bins containing a large number of colliding keys improve performance by storing their entries in a balanced tree instead of a linked list. This JDK 8 change applies only to HashMap, LinkedHashMap, and ConcurrentHashMap.

In rare situations, this change could introduce a change to the iteration order of HashMap and HashSet. A particular iteration order is not specified for HashMap objects - any code that depends on iteration order should be fixed.

Note that, other than removing the feature introduced in 7u6, the java.util.Hashtable class is not affected. The features added in 7u6 applied to WeakHashMap and Hashtable (and by extension Properties and Provider) but in JDK 8 these have been removed.


Oracle and/or its affiliates Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Contact Us