I've got a public List<FriendProfile> friends = new ArrayList<FriendProfile>();
. I initialize the friends list by reading the information from the server. The FriendProfile object contains a int called private int userPosition;
Once the friends list has been initialized, I would like to sort the friends list by having the FriendProfile object with the highest userPosition
at index 0 of the list and then sort by accordingly, index 1 with the second highest userPosition
...
I guess I could write an sorting algorithm, yet I'm looking for prewritten code (maybe the JDK has some methods to offer?)
Help is appreciated!