JDK-8024009 : Remove jdk.map.useRandomSeed system property
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-08-29
  • Updated: 2017-05-17
  • Resolved: 2013-09-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8 b108Fixed
Related Reports
Blocks :  
Blocks :  
Description
The random hashSeed was added as part of the alternative hashing work (JDK-7126277) as an added protection against hash collisions.

With the balanced tree work for HashMap & LinkedHashMap (JDK-8005698 and JDK-8010325), the alternative hash algorithm was removed, and the random hashSeed was made optional with a new system property, jdk.map.useRandomSeed.

Further work and analysis has been done in HashMap & LinkedHashMap (JDK-8023463), and the code that balanced trees use for comparing keys is being expanded.  At this point, using the random hashSeed adds no meaningful protection against hash collisions.  The performance benefit provided by balanced trees is present regardless of the hashSeed - there is no change in worst-case performance.  Given this, use of hashSeed by HashMap & LinkedHashMap will be removed in JDK-8023463.

This leaves Hashtable & WeakHashMap as the two remaining classes using a random hashSeed.  I propose this usage be removed as well, and that the jdk.map.useRandomSeed property be withdrawn from jdk8.

Comments
Is it worth considering updating WeakHashMap and Hashtable to support treeifying? (Alas if Hashtable did not extend from Dictionary it could extend from something more useful for code reuse purposes). Given the changes in JDK-08023463 for how LinkedHashMap extends from HashMap it may be possible to do similar tricks if WeakHashMap extends HashMap, perhaps with some additional hooks to ensure stale entries are removed from the table.
30-08-2013