Re: Comparator in the driver
- From: thufir <hawat.thufir@xxxxxxxxx>
- Date: Wed, 30 Apr 2008 12:51:54 GMT
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
.
- References:
- Comparator in the driver
- From: thufir
- Re: Comparator in the driver
- From: Matt Humphrey
- Re: Comparator in the driver
- From: thufir
- Comparator in the driver
- Prev by Date: Re: Comparator in the driver
- Next by Date: Re: Comparator in the driver
- Previous by thread: Re: Comparator in the driver
- Next by thread: Re: Comparator in the driver
- Index(es):
Relevant Pages
|