title: Efficiently and dynamically rank many users in memory?
body: <p>I run a Java game server where I need to efficiently rank players in various ways.  For example, by score, money, games won, and other achievements.  This is so I can recognize the top 25 players in a given category to apply medals to those players, and dynamically update them as the rankings change.  Performance is a high priority.</p>
  
  <p>Note that this cannot easily be done in the database only, as the ranks will come from different sources of data and different database tables, so my hope is to handle this all in memory, and call methods on the ranked list when a value needs to be updated.  Also, potentially many users can tie for the same rank.</p>
  
  <p>For example, let's say I have a million players in the database.  A given player might earn some extra points and instantly move from 21,305th place to 23rd place, and then later drop back off the top 25 list.  I need a way to handle this efficiently.  I imagine that some kind of doubly-linked list would be used, but am unsure of how to handle quickly jumping many spots in the list without traversing it one at a time to find the correct new ranking.  The fact that players can tie complicates things a little bit, as each element in the ranked list can have multiple users.</p>
  
  <p>How would you handle this in Java?</p>