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

Martin Buchholz martinrb at google.com
Thu Aug 22 15:10:34 UTC 2013


On Wed, Aug 21, 2013 at 5:25 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

>
> 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;
>     }
>

We've waffled about doing this kind of thing in j.u.c.  Our current jsr166
practice is not to have such helper methods if the number of required
@SuppressWarnings is not too oppressive.  We're willing to pay the
readability cost for core classes.



More information about the core-libs-dev mailing list