@Test public void testPut() { CaseInsensitiveTreeMap<Integer> m = new CaseInsensitiveTreeMap<>(); assertNull(m.put("a", 3)); m.checkStructure(); assertEquals(1, m.size()); assertNull(m.put("b", 0)); m.checkStructure(); assertEquals(2, m.size()); assertEquals(3, (int)m.put("a", 2)); m.checkStructure(); assertEquals(2, m.size()); assertEquals(0, (int)m.put("B", 5)); m.checkStructure(); assertEquals(2, m.size()); }
public V put(String key, V val) { String lower = key.toLowerCase(); String oldProper = caseConverter.put(lower, key); if (oldProper == null) return data.put(key, val); else { V result = data.remove(oldProper); data.put(key, val); return result; } }
CaseInsensitiveTreeMap extends AbstractMap<String,V> { public V put(String key, V val) { String lower = key.toLowerCase(); String oldProper = caseConverter.put(lower, key); if (oldProper == null) return data.put(key, val); else { V result = data.remove(oldProper); data.put(key, val); return result; } } }
CaseInsensitiveTreeMap extends AbstractMap<String,V> { public V put(String key, V val) { String lower = key.toLowerCase(); String oldProper = caseConverter.put(lower, key); if (oldProper == null) return data.put(key, val); else { V result = data.remove(oldProper); data.put(key, val); return result; } } CaseInsensitiveTreeMap(); }
CaseInsensitiveTreeMap extends AbstractMap<String,V> { public V put(String key, V val) { String lower = key.toLowerCase(); String oldProper = caseConverter.put(lower, key); if (oldProper == null) return data.put(key, val); else { V result = data.remove(oldProper); data.put(key, val); return result; } } CaseInsensitiveTreeMap(); boolean containsKey(Object obj); V get(Object obj); V put(String key, V val); V remove(Object obj); Set<Map.Entry<String,V>> entrySet(); }
CaseInsensitiveTreeMap extends AbstractMap<String,V> { public V put(String key, V val) { String lower = key.toLowerCase(); String oldProper = caseConverter.put(lower, key); if (oldProper == null) return data.put(key, val); else { V result = data.remove(oldProper); data.put(key, val); return result; } } CaseInsensitiveTreeMap(); boolean containsKey(Object obj); V get(Object obj); V put(String key, V val); V remove(Object obj); Set<Map.Entry<String,V>> entrySet();  }