Skip to content

Commit 0110aca

Browse files
author
Andrey Turbanov
committed
8354791: Use Hashtable.putIfAbsent in CSS constructor
Reviewed-by: serb, aivanov
1 parent 526951d commit 0110aca

File tree

1 file changed

+2
-6
lines changed
  • src/java.desktop/share/classes/javax/swing/text/html

1 file changed

+2
-6
lines changed

src/java.desktop/share/classes/javax/swing/text/html/CSS.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,8 @@ public CSS() {
735735
valueConvertor.put(CSS.Attribute.BACKGROUND_ATTACHMENT,
736736
valueMapper);
737737
Object generic = new CssValue();
738-
int n = CSS.Attribute.allAttributes.length;
739-
for (int i = 0; i < n; i++) {
740-
CSS.Attribute key = CSS.Attribute.allAttributes[i];
741-
if (valueConvertor.get(key) == null) {
742-
valueConvertor.put(key, generic);
743-
}
738+
for (CSS.Attribute key : CSS.Attribute.allAttributes) {
739+
valueConvertor.putIfAbsent(key, generic);
744740
}
745741
}
746742

0 commit comments

Comments
 (0)