playMaker

Author Topic: Sort on multiple dimensions  (Read 783 times)

matthutton

  • Playmaker Newbie
  • *
  • Posts: 21
Sort on multiple dimensions
« on: October 15, 2019, 02:50:07 PM »
I need to sort on two values. In this case, each user will have a score and a time. I'd like to sort first by their score, and then in the case of ties, by their time. Is that something I can do using hash tables and array lists?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Sort on multiple dimensions
« Reply #1 on: October 16, 2019, 02:28:03 AM »
Hi,

 yes, you can do that, I would for example do two arrays, one sorted by score and another by time.

 then when you build the final list you go through the score array, and when the same, you can check in the time array and use that order to decide who gets first.

It's cumbersome, I give you that.

Bye,

 Jean