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

Avoid redundant HashMap.containsKey call in Type1Font.expandAbbreviation

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 20
    • 17, 18, 19
    • client-libs
    • 2d
    • b07

    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.font.Type1Font#expandAbbreviation method:

          private String expandAbbreviation(String abbr) {
              if (styleAbbreviationsMapping.containsKey(abbr))
                              return styleAbbreviationsMapping.get(abbr);
              return abbr;
          }

      Instead we can just call
                 
              return styleAbbreviationsMapping.getOrDefault(abbr, abbr);

      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: