Use I am using sketchware IDE. How can I sort the the list by date or time modified.
I used this code
Arrays.sort(list, new Comparator<File>(){
@Override public int compare(File file1, File file2)
{
long k = file1.lastModified() - file2.lastModified();
if(k > 0)
{ return 1; }
else
if(k == 0)
{ return 0; }
else
{ return -1;
}
}
}
);
But I get an error:
The method sort(T[], Comparator<? super T>) in the type Arrays is not applicable for the arguments (ArrayList<String>, new Comparator<File>(){})