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

Avoid redundant HashMap.containsKey calls in NimbusDefaults.getDerivedColor

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 20
    • 17, 18
    • client-libs

    Description

      The method javax.swing.plaf.nimbus.NimbusDefaults#getDerivedColor(String,String,float,float,float,int,boolean) could be improved by usage of Map.putIfAbsent instead of separate containsKey/get/put calls. We known that HashMap javax.swing.plaf.nimbus.NimbusDefaults#derivedColors can contain only non-null values. And to check if putIfAbsent was successful or not, we can just compare result with null.
      It makes code a bit cleaner and faster.

      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: