Collections.synchronized* Javadoc could use see-also links
Chris Hennick
chrishennick1 at gmail.com
Mon Nov 11 21:12:18 UTC 2019
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
More information about the core-libs-dev
mailing list