Hello,
I have not tried what you are talking about, but I think i have a code which can help you. Just have a look at it.
Code:
Public static class cmch implements Comparator {
Public int compares(Object ob1, Object ob2){
if(ob1 == null & & O2 == null) return 0;
if(ob1 == null) return -1;
if(ob2 == null) return +1;/ / To stay commutative
int rs =((Room)ob2).getDesignation().
compareTo(((Room)ob1).getDesignation());
if (result! = 0) return result;
/ / same name, but the id must always be different => result always! = 0.
return ((Room)ob2).getId().compareTo(((Room)ob1).getId());
}
}
Bookmarks