Avoid redundant HashMap.containsKey calls in NimbusDefaults.getDerivedColor

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 20
    • Affects Version/s: 17, 18
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: