Sunday, June 28, 2009

Sort a list of Objects based on their names

 List sortSubPanelBasedOnNames(List subPanels) { 
Collections.sort(subPanels, new Comparator() {
public int compare(TestPanel panel1, TestPanel panel2) {
return (panel1.getInspectorName()).compareTo(panel2.getInspectorName());
}
});
return subPanels;
}

No comments: