RFR 8071667 : HashMap.computeIfAbsent() adds entry that HashMap.get() does not find.

Paul Sandoz paul.sandoz at oracle.com
Sat Mar 21 13:43:50 UTC 2015


On Mar 20, 2015, at 10:23 PM, Brent Christian <brent.christian at oracle.com> wrote:

> Here's the latest:
> 
> http://cr.openjdk.java.net/~bchristi/8071667/webrev.4/
> 
> That should have everything.
> 

Looks good (i assumed all but the test code has remained unchanged).

I like the test. A minor comment:

 125     private static void checkCME(Consumer code, boolean expectCME) {
 126         try {
 127             code.accept(null);
 128         } catch (ConcurrentModificationException cme) {
 129             if (expectCME) { return; } else { throw cme; }
 130         }
 131         if (expectCME) {
 132             throw new RuntimeException("Expected CME, but wasn't thrown");
 133         }        
 134     }
 135 
 136     private static BiFunction<String,String,String> mkBiFunc(Map map) {
 137         return (k,v) -> {
 138             putToForceRehash(map);
 139             return "computedValue";
 140         };
 141     }

Can you avoid using raw types?

Paul.



More information about the core-libs-dev mailing list