This class guarantees that the sorted set will be in ascending element order, sorted according to the natural order of the elements (see Comparable), or by the comparator provided at set creation time, depending on which constructor is used.
set = new TreeSet(new java.util.Comparator(){ public int compare(Object o1, Object o2){ UserNumData u1 = (UserNumData)o1; UserNumData u2 = (UserNumData)o2; return u1.getTelNum()+u1.getName().hashCode() - (u2.getTelNum()+u2.getName().hashCode()); } });
set = new TreeSet(new java.util.Comparator(){
public int compare(Object o1, Object o2){
UserNumData u1 = (UserNumData)o1;
UserNumData u2 = (UserNumData)o2;
return u1.getTelNum()+u1.getName().hashCode() - (u2.getTelNum()+u2.getName().hashCode());
}
});