Unchained Nullity
Nullity in Java can be a subtle business. If you call get(key)
on a plain HashMap
with a key that is not in the map, you will get null
back. If you call put(key, null)
on the same HashMap
, then get(key)
, you will also get null
back. In the former case, containsKey(key)
will return false
; in the latter (after insertion), true
: the null
you inserted is ge…
Keep reading with a 7-day free trial
Subscribe to codepoetics to keep reading this post and get 7 days of free access to the full post archives.