wood burning stoves 2.0*
The moose likes Cattle Drive and the fly likes OOP 3: SortNames Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "OOP 3: SortNames" Watch "OOP 3: SortNames" New topic
Author

OOP 3: SortNames

bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
I have a question about the SortNames assignment. I have it all working except for the sort by last name, as I am finding out this is the hardest part of the project.
When you say don't modify the Strings in the ArrayList, does that mean I can't make a copy of the ArrayList and modify those Strings. Basically I was thinking of taking a copy of the list, chopping off the first name, sorting it, and then comparing it back to the old array to print it in order. Is there an easier way or a class or method I am missing?
Thanks,
Bill
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Actually I found a slightly easier way, but I am still creating my own methods and not using something from the API.
Bill
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Rather than create a new list, the purpose of the assignment is for you to use the existing list and force a new way to do the sorting.� Take a look at an alternative way to call Collections.sort()

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
Thanks Marilyn. I see it now. I have never used that method so it was nice to see how it works.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OOP 3: SortNames