Performance enhancements.

  - Replaced for each loops with optimised for loops.
  - Added noinspection comments to said loops so I don't change them back accidentally later on.
  - Used final where possible.
  - Made some private methods static.
  - There's some duplicate code in this file I noticed, but I'm not going to refactor it just yet. Are there performance benefits or something?
  - Rearranged method parameters in one method to allow for varargs (style).

git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk@1589014 13f79535-47bb-0310-9956-ffa450edef68