The JavaDoc of ConcurrentHashMap
says this:
Like Hashtable
but unlike HashMap
, this class does not allow null
to be used as a key or value.
My question: Why?
2nd question: Why doesn't Hashtable
allow null?
I've used a lot of HashMaps for storing data. But when changing to ConcurrentHashMap
I got several times into trouble because of NullPointerExceptions.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…