/** * Convert the given key to a case-insensitive key. * <p>The default implementation converts the key * to lower-case according to this Map's Locale. * @param key the user-specified key * @return the key to use for storing * @see String#toLowerCase(Locale) */ protected String convertKey(String key) { return key.toLowerCase(getLocale()); }
/** * Convert the given key to a case-insensitive key. * <p>The default implementation converts the key * to lower-case according to this Map's Locale. * @param key the user-specified key * @return the key to use for storing * @see String#toLowerCase(Locale) */ protected String convertKey(String key) { return key.toLowerCase(getLocale()); }
@Test public void mapClone() { assertNull(map.put("key", "value1")); LinkedCaseInsensitiveMap<String> copy = map.clone(); assertEquals(map.getLocale(), copy.getLocale()); assertEquals("value1", map.get("key")); assertEquals("value1", map.get("KEY")); assertEquals("value1", map.get("Key")); assertEquals("value1", copy.get("key")); assertEquals("value1", copy.get("KEY")); assertEquals("value1", copy.get("Key")); copy.put("Key", "value2"); assertEquals(1, map.size()); assertEquals(1, copy.size()); assertEquals("value1", map.get("key")); assertEquals("value1", map.get("KEY")); assertEquals("value1", map.get("Key")); assertEquals("value2", copy.get("key")); assertEquals("value2", copy.get("KEY")); assertEquals("value2", copy.get("Key")); }
/** * Convert the given key to a case-insensitive key. * <p>The default implementation converts the key * to lower-case according to this Map's Locale. * @param key the user-specified key * @return the key to use for storing * @see String#toLowerCase(Locale) */ protected String convertKey(String key) { return key.toLowerCase(getLocale()); }
/** * Convert the given key to a case-insensitive key. * <p>The default implementation converts the key * to lower-case according to this Map's Locale. * @param key the user-specified key * @return the key to use for storing * @see String#toLowerCase(Locale) */ protected String convertKey(String key) { return key.toLowerCase(getLocale()); }