Minor code cleanup to eliminate IDE warnings.

Removes code that triggers Intellij IDEA warnings about unused
imports, redundant initializers, loops that can be replaced with
for-each, etc.