Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-65427

Iterate on entrySet instead of keySet to avoid calling Map.get for each key

    Details

    • Type: Story
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects Version/s: None
    • Fix Version/s: Master
    • Component/s: Performance
    • Labels:
      None

      Description

      Instead of using

      for (String key : map.keySet()) {
          doSomethingWith(key, map.get(key));
      }
      

      , use

      for (Map.Entry<String, String> entry : map.entrySet()) {
          doSomethingWith(entry.getKey(), entry.getValue());
      }
      

      where possible to avoid calling Map.get(key).

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                Master