Duplicate key in TreeMap
java
Solution
`TreeMap#public V put(K key, V value)` API says
Associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced.
Problem
I have the below code for tree map where I store duplicate key and it seems overwrite the existing one. ``` TreeMap<String, Integer> tm=new TreeMap<>(); tm.put("vivek", 1); tm.put("vivek", 2); System.out.println(tm); ``` It prints `{vivek=2}` So it means map allow to overwrite on key basis?