Java: sorting arraylist, need some help

September 29, 2009 at 02:53:32
Specs: Windows 7, 1.9Ghz/3Gb
I have been going round in circles about this problem now, I desperately need help.
I am trying to do a highscore list in Java which needs to store 10 names and their scores and it should be sorted from lowest score to highest and printed out at the end.

So, my ideas have been:
ArrayList - been working mostly on this to work, and I actually got one name and one score to stay there, but not a total sorted list. And I also need to make it private in the class so the list actually updates within the running method, until I quit it.

Map - LinkedMap, Hashmaps etc, I noticed that didn't really work out as I imagined.

I got a suggestion to write a new object, something like this:

private ArrayList <HighScore> hs;

what does that mean, to put a new name between the '<>'?

Hope to get some helping words.

See More: Java: sorting arraylist, need some help

Report •

September 29, 2009 at 04:22:43
It sounds like you need to read up on Generics in Java.

Report •
Related Solutions

Ask Question