When I was fresh out of college, I ended up reinventing the
ConcurrentHashMap wheel because I wasn't aware of it. I knew about
Collections.synchronizedMap(), but knew that locking the entire map for a
get or put (rather than just the hash bucket it hit) would prevent my
program from benefiting from parallelization.

To assist in the education of newer Java developers, why not create
see-also links from the Collections.synchronized* methods' Javadocs to the
corresponding concurrent collections, where those exist? Those would
include at least the following:

   - synchronizedMap -> ConcurrentHashMap
   - synchronizedSet -> ConcurrentHashMap.newKeySet()
   - synchronizedSortedMap & synchronizedNavigableMap ->
   ConcurrentSkipListMap
   - synchronizedNavigableSet & synchronizedSortedSet ->
   ConcurrentSkipListSet

Sincerely,
Chris Hennick

Reply via email to