RFR 8023463 Update HashMap and LinkedHashMap to use bins/buckets or trees (red/black)

Paul Sandoz paul.sandoz at oracle.com
Wed Aug 21 12:25:37 UTC 2013


Hi,

Here are Doug's Linked/HashMap changes, discussed in a previous thread, as a webrev:

  http://cr.openjdk.java.net/~psandoz/tl/JDK-8023463-Linked-HashMap-bin-and-tree/webrev/

I also added some tests related to characteristics associated with fixing another bug.

Looking at the diffs will be tricky given there are so many changes.


I fixed unchecked warnings in LinkedHashMap, but have not done so for HashMap, where there are many more casts from Node to TreeNode. One way to solve that is with a static method:

    @SuppressWarnings("unchecked")
    static <K, V> TreeNode<K, V> asTreeNode(Node<K, V> n) {
        return (TreeNode<K, V>) n;
    }

but i dunno what the performance implications are. Perhaps it's best to simply stuff @SuppressWarnings on methods of TreeNode rather than trying to modify code just for the sake of reducing the scope.


A JPRT job has been kicked off.

I recommend when this code goes in we look closely at code coverage results to see if we are missing areas testing tree functionality and update/add new tests accordingly.

Paul.



More information about the core-libs-dev mailing list