Reputation: 322
Okay, so this is a silly question. I recently found dead code along the lines of:
Something a = hashMap.get("key");
IntelliJ Idea was complaining that a was never used, so I told it to remove it. At that point it yelled at me, that removing the entire line could have side effects, and it offered me to leave it as:
hashMap.get("key");
Now that got me thinking, what are the potential side effects of get?
Upvotes: 1
Views: 210
Reputation: 325
I don't think there are any. The documentation does not mention any changes to map. I assume that it is yelling at you because you don't use a
and it is an unnecessary variable. Hope this helps.
Upvotes: 0