Easy way to sort a Collection for e.g. dropdown.
Collections.sort(<Collection of SecletItem's>, new SecletItemComparator());
// Inner class
public class SecletItemComparator implements Comparator{
@Override
public int compare(SelectItem s1, SelectItem s2) {
return s1.getLabel().compareTo(s2.getLabel());
}
}
1 comments:
I Dont think we need the override tag. Worked for me...thank you.
Post a Comment