I am using Comparator to compare files by size, but when I tried to compile my code i got warning: "java uses unchecked or unsafe operations". I put my code into comments and than the program worked, so I think is the problem with sorting in Comparator class. Here is my code:
public class size implements Comparator {
@Override
public int compare(Object o1, Object o2) {
long s1 = ((Class)o1).getSize();
long s2 = ((Class)o2).getSize();
if (s1 > s2){
return 1;
}
else if (s1 < s2){
return -1;
}
else {
return 0;
}
}
}