posted 9 years ago
I came across a code snippet which iterates over a map using its entry set and performs some action only if entry != null
As far as I know even if we don't enter anything in map this method returns an empty set and not a null set.
Even if I put {null,null} then the entry will be [null,null] employing an instance of set with these elements.
I have below question:
1. Under what scenario an entry in HashMap will it be NULL?
2. Is the check even valid ?