I have an array of objects, these objects all have multiple values stored within them. I have them within an object array.
class PlayerScores {
String playerName;
int pos=0;
int played=0;
int win=0;
int draw=0;
int lose=0;
int goalsFor=0;
int goalsAgainst=0;
int goalDifference=0;
int points=0;
public PlayerScores() {
}
}
These are stored within the array:
Player Scores[] playersObjects = new PlayerScores[int];
playersObjects[i] = new PlayerScores();
I want to search through 'playersObject[]' and order then in a new object array with the Player with the highest points first in the array and the rest in descending order. I am not sure how to run a sort on a single value within an object.
Any help would be massively appreciated,
Thanks.
ArrayList(i.e. useArrays.sortinstead ofCollections.sort), though admittedly it's markedly similar and doubtless there's another question out there that covers the same material somewhere on SO...