예제 #1
0
 @Override
 public boolean equals(Object obj) {
   if (obj == this) return true;
   if (!(obj instanceof User)) return false;
   User u = (User) obj;
   return u.getName().equalsIgnoreCase(this.getName());
 }
예제 #2
0
 @Override
 public int compareTo(User u) {
   // sort users by name :
   return this.getName().compareTo(u.getName());
 }