KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ContactComparator


1 import java.util.*;
2
3 /** This class compares contact list items.*/
4 final class ContactComparator implements Comparator{
5         
6     private final java.text.Collator JavaDoc c=java.text.Collator.getInstance(new java.util.Locale JavaDoc(WhisperIM.UserPref.getProperty("lang")));
7         
8     public ContactComparator(){
9         c.setStrength(java.text.Collator.IDENTICAL);
10     }
11         
12     public int compare(Object JavaDoc o1, Object JavaDoc o2){
13         String JavaDoc s1=((ContactListItem) o1).toString();
14         String JavaDoc s2=((ContactListItem) o2).toString();
15         return c.compare(s1,s2);
16     }
17         
18     public boolean equals(Object JavaDoc obj){
19         return this==obj;
20     }
21 }
Popular Tags