title: java concurrent map sorted by value
body: <p>I'm looking for a way to have a concurrent map or similar key->value storage that can be sorted by value and not by key.</p>
  
  <p>So far I was looking at <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentSkipListMap.html" rel="nofollow">ConcurrentSkipListMap</a> but I couldn't find a way to sort it by value (using <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html" rel="nofollow">Comparator</a>), since <code>compare</code> method receives only the keys as parameters.</p>
  
  <p>The map has keys as String and values as Integer. What I'm looking is a way to retrieve the key with the smallest value(integer).</p>
  
  <p>I was also thinking about using 2 maps, and create a separate map with Integer keys and String values and in this way I will have a sorted map by integer as I wanted, however there can be more than one integers with the same value, which could lead me into more problems.</p>
  
  <p>Example</p>
  
  <p>"user1"=>3
  "user2"=>1
  "user3"=>3</p>
  
  <p>sorted list: 
  "user2"=>1
  "user1"=>3
  "user3"=>3</p>
  
  <p>Is there a way to do this or are any 3rd party libraries that can do this?</p>
  
  <p>Thanks</p>