Hi,
I need help in passing a Java Generics List to Collections.sort(). Here is my code:
List<MyObject> orgMyObjectList = new ArrayList<MyObject>();
Collections.sort(orgMyObjectList, new Comparable<MyObject>() {
public int compareTo(MyObject another) {
// TODO Auto-generated method stub
return 0;
}
});
But I get this compiler error in eclipse: The method sort(List, Comparator) in the type Collections is not applicable for the arguments (List, new Comparable< MyObject >(){})
Can you please tell me how to fix it?