log(n) "sort by value" Map?
put seems quite broken, which in turn breaks get.

From the documentation,


  V put(K key, V value)
  
  Associates the specified value with the specified key in this map
  (optional operation). If the map previously contained a mapping for
  the key, the old value is replaced by the specified value. (A map m is
  said to contain a mapping for a key k if and only if m.containsKey(k)
  would return true.)
  
  Returns:
  the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)


Let's take this code

  myMap.put("x", 1);
  int oldValue = myMap.put("x", 2);
  System.out.printf("%d %d%n", oldValue, myMap.get("x"));


I would expect it to print 1 2, but it prints 3 3.