I have a map that is already populated, When calling map.get(key)
If element against that key exists it return it’s corresponding value which can be null and if not then still null. I wanna know whether the element for that key exists in the map or not.
Note that I can’t alter/modifiy values directly and use containsKey
method here since it is an expensive operation considering larger size of map.
I’ve tried Hashtable
but it turns out to be disaster for me.
Muhammad Haris is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1