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

Avoid redundant HashMap.containsKey calls in NimbusDefaults.getDerivedColor

XMLWordPrintable

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

      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.

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

              Created:
              Updated:
              Resolved: