Interview Question
Country: United States
I think we can iterate the entire map and keep replacing key with value.. and set value as null..
@Eugene: This was asked in an interview. I know it doesn't make sense to remove keys alone, but may be interviewer wants to check some thing else here like how to iterate and remove entries from a map or something like that !!
Thanks for the suggestion !!
Hashmaps store things by key, so what you're asking for doesn't make much sense. Every stored value must have an associated key.
- eugene.yarovoi October 29, 2012