CustCompByAge - if ( compare == 0) { if(c1.getAge() ==...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; class CustCompByAge implements Comparator { public CustCompByAge() { } public int compare(Object obj1, Object obj2) { { Customer c1 = (Customer)obj1; Customer c2 = (Customer)obj2; int compare = c1.getName().compareTo(c2.getName());
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if ( compare == 0) { if(c1.getAge() == c2.getAge()) { return 0; } else if(c1.getAge() > c2.getAge()) { return 1; } else if(c1.getAge() < c2.getAge()) { return -1; } else return 1; } else return 1; } else return -100; } }...
View Full Document

This note was uploaded on 03/25/2010 for the course CIS CIS3023 taught by Professor Seema during the Spring '10 term at Florida College.

Ask a homework question - tutors are online