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: I0665fc896ddfeeb542727c91beac650b18e8743e