This is a followup question to "What Hit Dice do multiclass characters spend at the end of a short rest?".

Under the rules for Short Rest (PHB 186):


  A character can spend one or more Hit Dice at the end of a short rest, up to the characters maximum number of Hit Dice, which is equal to the character's level. For each Hit Die spent in this way, the player rolls the die and adds the characters Constitution modifier to it. The character regains hit points equal to the total.


I have a multiclass character - level 1 Monk (d8 Hit Die), levels 2 - 4 Wizard (d6 Hit Die). At the end of a short rest I can spend up to 1d8 and 3d6 Hit Dice to regain hit points.

Can I spend the dice from my pool in any order? Or do I have to spend them in the order that I got my class levels - so always a d8 first, then the d4's?


Question: Multiple orders in a single list
Answer: As you say yourself, the best solution is to do the counting in the output, instead of storing it in the various lists. That way you don't have to store (and recalculate) the ranking numbers on each event for each (sub-)list, but you only calculate them when needed.

For the "You are on position # in the ranking" text, you could have a method in the class that represents the ranking list, like this: RankingList::getRankingOf(Player). Only if this information is costly to obtain and you only need the ranking from the overall list, you could consider caching the current ranking numbers in the overall list (as an optimisation strategy).