Computing.Net > Forums > Programming > Java: sorting arraylist, need some help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java: sorting arraylist, need some help

Reply to Message Icon

Name: loudnoise
Date: September 29, 2009 at 02:53:32 Pacific
OS: Windows 7
CPU/Ram: 1.9Ghz/3Gb
Subcategory: Java
Comment:

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.



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: September 29, 2009 at 04:22:43 Pacific
Reply:

It sounds like you need to read up on Generics in Java.


0
Reply to Message Icon

Related Posts

See More


please help for this... Using Javascript under WS...


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Java: sorting arraylist, need some help

Need programmers help!! www.computing.net/answers/programming/need-programmers-help/2136.html

multiple character input in java www.computing.net/answers/programming/multiple-character-input-in-java/11585.html

Need help with JAVA www.computing.net/answers/programming/need-help-with-java/4465.html