public class CompareToImplementsComparator implements Comparator {
public int compare(Object o1, Object o2) {
int i=(Integer)o1;
int j=(Integer)o2;
if(i>j){
return 1;
}
return 0;
}
@SuppressWarnings("unchecked")
public static void main(String[] args) {
List<Integer> list=new ArrayList();
for(int i=10;i>0;i--){
list.add(i);
}
Collections.sort(list, new CompareToImplementsComparator());
for(int j=0;j<list.size();j++){
System.out.println(list.get(j));
}
}
}