Barry Gaunt said RTFRequirements again and again! Make a checklist
Requirements checklist for SortNames Work with an ArrayList Implement an Interface Use I/O ======================= Load ArrayList with Strings from text file Show names sorted in order by First Names then Last Names Use com.javaranch.common.TextFileIn Use Collections for sorting ***Do not create second list ***Do not modify ArrayList except by using Collections class Class will be called SortNames
Question: What is the possible relationship between Collections.sort and compareTo()? Or Collections and compareTo()? Or is the compareTo() method to be used somehow in a println() / loop struct as comparisons are made? Thanks [ May 15, 2003: Message edited by: Donald R. Cossitt ]
DC: Question: What is the possible relationship between Collections.sort and compareTo()? There are several flavors of Collections.sort(). Make sure you understand when you'd want to use one or the other.
There are several flavors of Collections.sort(). Make sure you understand when you'd want to use one or the other.
Having done that, it is apparent that there is at least one other Interface candidate to satisfy the assignment. Is it safe to ask or say that Comparable is not it? Or in addition to the other? (Hope this makes sense, trying to be discrete is so out of character for me ) Thanks
Marilyn to question in antiquity: Question 1) Is it correct that I can NOT write a method, which separates the names, sorts them via Collection class, and puts them afterwards together via kind of backward cut-and-paste? Yes, as long as you don't store the reversed names into another ArrayList or array, etc.
If the project is accomplished in this manner, would this not be in violation of "implementing an Interface" in that one would not be needed? Or is it ok to Implement / Override and not use the required abstract method? Just kinda have it there for...? [ May 17, 2003: Message edited by: Donald R. Cossitt ]