use ConcurrentHashMap to replace Collections.synchronizedMap(HashMap) ?

Xeno Amess xenoamess at gmail.com
Wed Apr 20 18:26:18 UTC 2022


Collections.synchronizedMap(new HashMap<Integer, byte[]>())

new ConcurrentHashMap <Integer, byte[]>  ()

Is the later one always better than the first one?

I personally think so, but are there any traps in it?


More information about the jdk-dev mailing list