1
1
/*
2
- * Copyright (c) 1998, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1998, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
30
30
import java .io .Serial ;
31
31
import java .io .Serializable ;
32
32
import java .util .Hashtable ;
33
+ import java .util .Map ;
33
34
34
35
import javax .swing .text .AttributeSet ;
35
36
import javax .swing .text .StyleConstants ;
@@ -1169,7 +1170,16 @@ public String toString() {
1169
1170
private static final Hashtable <String , Tag > tagHashtable = new Hashtable <String , Tag >(73 );
1170
1171
1171
1172
/** Maps from StyleConstant key to HTML.Tag. */
1172
- private static final Hashtable <Object , Tag > scMapping = new Hashtable <Object , Tag >(8 );
1173
+ private static final Map <Object , Tag > scMapping = Map .of (
1174
+ StyleConstants .Bold , Tag .B ,
1175
+ StyleConstants .Italic , Tag .I ,
1176
+ StyleConstants .Underline , Tag .U ,
1177
+ StyleConstants .StrikeThrough , Tag .STRIKE ,
1178
+ StyleConstants .Superscript , Tag .SUP ,
1179
+ StyleConstants .Subscript , Tag .SUB ,
1180
+ StyleConstants .FontFamily , Tag .FONT ,
1181
+ StyleConstants .FontSize , Tag .FONT
1182
+ );
1173
1183
1174
1184
static {
1175
1185
@@ -1185,14 +1195,6 @@ public String toString() {
1185
1195
allAttributes [i ]);
1186
1196
}
1187
1197
StyleContext .registerStaticAttributeKey (HTML .NULL_ATTRIBUTE_VALUE );
1188
- scMapping .put (StyleConstants .Bold , Tag .B );
1189
- scMapping .put (StyleConstants .Italic , Tag .I );
1190
- scMapping .put (StyleConstants .Underline , Tag .U );
1191
- scMapping .put (StyleConstants .StrikeThrough , Tag .STRIKE );
1192
- scMapping .put (StyleConstants .Superscript , Tag .SUP );
1193
- scMapping .put (StyleConstants .Subscript , Tag .SUB );
1194
- scMapping .put (StyleConstants .FontFamily , Tag .FONT );
1195
- scMapping .put (StyleConstants .FontSize , Tag .FONT );
1196
1198
}
1197
1199
1198
1200
/**
0 commit comments