Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8287053

Avoid redundant HashMap.containsKey calls in ZoneInfoFile.getZoneInfo0

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 19
    • None
    • core-libs

    Description

      In java 8, Map interface was enhances with many useful methods, which allow to avoid calling a few separate Map methods.
      One of such example is in sun.util.calendar.ZoneInfoFile#getZoneInfo0 method:

                  String zid = zoneId;
                  if (aliases.containsKey(zoneId)) {
                      zid = aliases.get(zoneId);
                  }

      Instead we can just call
                 
                 aliases.getOrDefault(zoneId, zoneId)

      Attachments

        Issue Links

          Activity

            People

              aturbanov Andrey Turbanov
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: