@@ -47,41 +47,42 @@ public class LinkedCaseInsensitiveMap<V> implements Map<String, V>, Serializable
47
47
48
48
49
49
/**
50
- * Create a new LinkedCaseInsensitiveMap for the default Locale.
51
- * @see java.lang.String#toLowerCase()
50
+ * Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys
51
+ * according to the default Locale (by default in lower case).
52
+ * @see #convertKey(String)
52
53
*/
53
54
public LinkedCaseInsensitiveMap () {
54
55
this ((Locale ) null );
55
56
}
56
57
57
58
/**
58
- * Create a new LinkedCaseInsensitiveMap that stores lower- case keys
59
- * according to the given Locale.
60
- * @param locale the Locale to use for lower- case conversion
61
- * @see java.lang.String#toLowerCase(java.util.Locale )
59
+ * Create a new LinkedCaseInsensitiveMap that stores case-insensitive keys
60
+ * according to the given Locale (by default in lower case) .
61
+ * @param locale the Locale to use for case-insensitive key conversion
62
+ * @see #convertKey(String )
62
63
*/
63
64
public LinkedCaseInsensitiveMap (Locale locale ) {
64
65
this (16 , locale );
65
66
}
66
67
67
68
/**
68
69
* Create a new LinkedCaseInsensitiveMap that wraps a {@link LinkedHashMap}
69
- * with the given initial capacity and stores lower- case keys according
70
- * to the default Locale.
70
+ * with the given initial capacity and stores case-insensitive keys
71
+ * according to the default Locale (by default in lower case) .
71
72
* @param initialCapacity the initial capacity
72
- * @see java.lang.String#toLowerCase( )
73
+ * @see #convertKey(String )
73
74
*/
74
75
public LinkedCaseInsensitiveMap (int initialCapacity ) {
75
76
this (initialCapacity , null );
76
77
}
77
78
78
79
/**
79
80
* Create a new LinkedCaseInsensitiveMap that wraps a {@link LinkedHashMap}
80
- * with the given initial capacity and stores lower- case keys according
81
- * to the given Locale.
81
+ * with the given initial capacity and stores case-insensitive keys
82
+ * according to the given Locale (by default in lower case) .
82
83
* @param initialCapacity the initial capacity
83
- * @param locale the Locale to use for lower- case conversion
84
- * @see java.lang.String#toLowerCase(java.util.Locale )
84
+ * @param locale the Locale to use for case-insensitive key conversion
85
+ * @see #convertKey(String )
85
86
*/
86
87
public LinkedCaseInsensitiveMap (int initialCapacity , Locale locale ) {
87
88
this .targetMap = new LinkedHashMap <String , V >(initialCapacity ) {
@@ -113,6 +114,8 @@ private LinkedCaseInsensitiveMap(LinkedCaseInsensitiveMap<V> other) {
113
114
}
114
115
115
116
117
+ // Implementation of java.util.Map
118
+
116
119
@ Override
117
120
public int size () {
118
121
return this .targetMap .size ();
@@ -227,16 +230,29 @@ public String toString() {
227
230
}
228
231
229
232
233
+ // Specific to LinkedCaseInsensitiveMap
234
+
235
+ /**
236
+ * Return the locale used by this {@code LinkedCaseInsensitiveMap}.
237
+ * Used for case-insensitive key conversion.
238
+ * @since 4.3.10
239
+ * @see #LinkedCaseInsensitiveMap(Locale)
240
+ * @see #convertKey(String)
241
+ */
242
+ public Locale getLocale () {
243
+ return this .locale ;
244
+ }
245
+
230
246
/**
231
247
* Convert the given key to a case-insensitive key.
232
248
* <p>The default implementation converts the key
233
249
* to lower-case according to this Map's Locale.
234
250
* @param key the user-specified key
235
251
* @return the key to use for storing
236
- * @see java.lang. String#toLowerCase(java.util. Locale)
252
+ * @see String#toLowerCase(Locale)
237
253
*/
238
254
protected String convertKey (String key ) {
239
- return key .toLowerCase (this . locale );
255
+ return key .toLowerCase (getLocale () );
240
256
}
241
257
242
258
/**
0 commit comments