Merge pull request #8831 from hrk/spotbugs-boxed-primitive-for-compare

Fix: boxed primitive for compare
This commit is contained in:
Tobias Kaminsky 2021-09-29 12:18:03 +02:00 committed by GitHub
commit ecbb64bbba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View file

@ -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);

View file

@ -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());
}
});

View file

@ -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;