Clean up critical Sonar warnings

https://trello.com/c/sfAuv3lS

Cleaned errors:
* Performance - Inefficient use of keySet iterator instead of entrySet iterator
* Dodgy - Redundant nullcheck of value known to be non-null

Change-Id: I3e651caa9fe1dd0104b6b7963c6de600519182fa