Sorting an object based on 2 values
Posted on 2006-11-02
Hello, I have an array of objects with 2 fields: String Key, and int dID.
What I want to do is sort the array first by the Key, and then by the dID.
Becomes: "Apple", 9
Before I start sorting, the array is already sorted by dID, so I am wondering if there is a sorting algorithm that will sort the Keys, while keeping the dID's in order like my example above.
If there is no such algorithm, what is the best method to go about achieving this?