mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
Merge pull request #8831 from hrk/spotbugs-boxed-primitive-for-compare
Fix: boxed primitive for compare
This commit is contained in:
commit
ecbb64bbba
3 changed files with 5 additions and 11 deletions
|
@ -60,8 +60,7 @@ public class FileSortOrderByDate extends FileSortOrder {
|
|||
final int multiplier = isAscending ? 1 : -1;
|
||||
|
||||
Collections.sort(files, (o1, o2) -> {
|
||||
Long obj1 = o1.getDeletionTimestamp();
|
||||
return multiplier * obj1.compareTo(o2.getDeletionTimestamp());
|
||||
return multiplier * Long.compare(o1.getDeletionTimestamp(),o2.getDeletionTimestamp());
|
||||
});
|
||||
|
||||
return super.sortTrashbinFiles(files);
|
||||
|
|
|
@ -55,8 +55,7 @@ public class FileSortOrderBySize extends FileSortOrder {
|
|||
} else if (o2.isFolder()) {
|
||||
return 1;
|
||||
} else {
|
||||
Long obj1 = o1.getFileLength();
|
||||
return multiplier * obj1.compareTo(o2.getFileLength());
|
||||
return multiplier * Long.compare(o1.getFileLength(),o2.getFileLength());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -82,8 +81,7 @@ public class FileSortOrderBySize extends FileSortOrder {
|
|||
} else if (o2.isFolder()) {
|
||||
return 1;
|
||||
} else {
|
||||
Long obj1 = o1.getFileLength();
|
||||
return multiplier * obj1.compareTo(o2.getFileLength());
|
||||
return multiplier * Long.compare(o1.getFileLength(),o2.getFileLength());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -108,8 +106,7 @@ public class FileSortOrderBySize extends FileSortOrder {
|
|||
} else if (o2.isDirectory()) {
|
||||
return 1;
|
||||
} else {
|
||||
Long obj1 = o1.length();
|
||||
return multiplier * obj1.compareTo(o2.length());
|
||||
return multiplier * Long.compare(o1.length(),o2.length());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -262,9 +262,7 @@ public final class FileStorageUtils {
|
|||
public static List<OCFile> sortOcFolderDescDateModifiedWithoutFavoritesFirst(List<OCFile> files) {
|
||||
final int multiplier = -1;
|
||||
Collections.sort(files, (o1, o2) -> {
|
||||
@SuppressFBWarnings(value = "Bx", justification = "Would require stepping up API level")
|
||||
Long obj1 = o1.getModificationTimestamp();
|
||||
return multiplier * obj1.compareTo(o2.getModificationTimestamp());
|
||||
return multiplier * Long.compare(o1.getModificationTimestamp(),o2.getModificationTimestamp());
|
||||
});
|
||||
|
||||
return files;
|
||||
|
|
Loading…
Reference in a new issue