Re: Comparator in the driver



On Wed, 30 Apr 2008 12:35:32 +0000, thufir wrote:


Due to the requirements, I can only use a Comparator for the last name
(rather than for City as I had mentioned in my post). I'd like to move
the Comparator outside of the driver, but for now it's fine where it is.

ROFL -- I had some dummy data in there, I was returning 0 regardless of
anything else! Seems to work now(just have to clean up):

thufir@arrakis:~/bcit-comp2611-lab3$
thufir@arrakis:~/bcit-comp2611-lab3$ cat -n src/a00720398/labs/Lab3.java
| head -n 90 | tail -n 12
79 static final Comparator<Guest> BY_NAME = new
Comparator<Guest>(){
80 public int compare(Guest g1, Guest g2){
81 ContactInfo c1 = g1.getContactInfo();
82 ContactInfo c2 = g2.getContactInfo();
83 System.out.println("******************");
84 String s1 = c1.getLastName();
85 String s2 = c2.getLastName();
86 int foo = s1.compareTo(s2);
87 System.out.println(foo);
88 return foo;
89 }
90 };
thufir@arrakis:~/bcit-comp2611-lab3$


I'd like to put this Comparator into a00720398.util.CollectionUtil and
still keep the collections in the driver to meet other requirements.

Any pointers as to how to do that?



thanks,

Thufir
.



Relevant Pages

  • Re: Comparator in the driver
    ... Comparator be placed outside of the driver? ... It would have to either use public fields or public methods. ... Roedy Green Canadian Mind Products ...
    (comp.lang.java.help)
  • Re: About Hours of Work
    ... Sander destroys van ... On the morning of Feb. 3 my vehicle was legally parked one minute, and the next it was destroyed by a city sanding truck. ... The first was from the driver herself who stated a dog jumped in front of her so she swerved into my van to miss it. ... The second excuse came from the department supervisor who stated the driver had been working all night and was tired. ...
    (misc.transport.trucking)
  • Re: Sounds like a party gone bad.
    ... > motorcycle involved in an accident in the rough Mexican border city of ... > Tijuana was in fact a corpse which the driver had been carrying through ... > The police officer checked the passenger, who had been seated behind the ...
    (rec.motorcycles.harley)
  • Sounds like a party gone bad.
    ... MEXICO CITY -- Police discovered on Friday that a passenger on a ... Tijuana was in fact a corpse which the driver had been carrying through the ... The motorcycle driver lost control and skidded in the downtown area and when ... The police officer checked the passenger, who had been seated behind the ...
    (rec.motorcycles.harley)
  • Re: Sounds like a party gone bad.
    ... > motorcycle involved in an accident in the rough Mexican border city of ... > Tijuana was in fact a corpse which the driver had been carrying through ... > The motorcycle driver lost control and skidded in the downtown area and ... > The police officer checked the passenger, who had been seated behind the ...
    (rec.motorcycles.harley)