Is there a way to add a key to a HashMap without also adding a value? I know it seems strange, but I have a HashMap
amd I wan
Yes, it was confusing enough ;) I don't get why you want to store keys without values instead just putting empty arraylists instead of null
.
Adding null
may be a problem, because if you call
map.get("somekey");
and receive a null
, then you do not know, if the key is not found or if it is present but maps to null
...