Skip to content

Commit

Permalink
8287603: Avoid redundant HashMap.containsKey calls in NimbusDefaults.…
Browse files Browse the repository at this point in the history
…getDerivedColor

Reviewed-by: attila, aivanov
  • Loading branch information
Andrey Turbanov committed Jul 5, 2022
1 parent 4c997ba commit fd1bb07
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ ${UI_DEFAULT_INIT}
* Get a derived color, derived colors are shared instances and will be
* updated when its parent UIDefault color changes.
*
* @param uiDefaultParentName The parent UIDefault key
* @param parentUin The parent UIDefault key
* @param hOffset The hue offset
* @param sOffset The saturation offset
* @param bOffset The brightness offset
Expand Down Expand Up @@ -710,10 +710,10 @@ ${UI_DEFAULT_INIT}
bOffset, aOffset);
}

if (derivedColors.containsKey(color)) {
return derivedColors.get(color);
DerivedColor prev = derivedColors.putIfAbsent(color, color);
if (prev != null) {
return prev;
} else {
derivedColors.put(color, color);
color.rederiveColor(); /// move to ARP.decodeColor() ?
colorTree.addColor(uin, color);
return color;
Expand Down

1 comment on commit fd1bb07

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.