Performance improvement

Use entrySet instead of keySet followed by a lookup per key as the
former is more efficient.

Issue: SPR-12363
Merge pull request #672 from RyuSangGi/SPR-12363

* SPR-12363:
  Performance improvement