you can use the Arrays.sort () method, which uses Comparator, and write your own comparator, which compares the records according to your own rules, for example:
String[] children = ((File) parent).list(); Arrays.sort(children, new Comparator<String>() { @Override public int compare(String o1, String o2) {
In model methods, this will be an overload, so you can consider saving the directory in the modelβs personal field and checking if the directory was changed when the model methods were called (File.lastModified () comparison may help). If it was - save a new ad.
source share