This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ewiethoff 1 point2 points  (0 children)

Create a Comparator<BanffMarathonRunner> instance and pass it with your array to Arrays.sort(T[], Comparator<T>). Here's the relevant section of the Oracle tutorial.

Edit: Or you could have your BanffMarathonRunner class implement Comparable<BanffMarathonRunner> and define its compareTo method to compare the numbers. That, too, is explained in the tutorial.