Replace conditional with compare method
This commit is contained in:
parent
bb9e3a506e
commit
82a8d0fff8
|
@ -228,31 +228,13 @@ public class OfflineMusicService implements MusicService {
|
|||
}
|
||||
|
||||
Collections.sort(artists, (lhs, rhs) -> {
|
||||
if (lhs.getCloseness() == rhs.getCloseness()) {
|
||||
return 0;
|
||||
} else if (lhs.getCloseness() > rhs.getCloseness()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
|
||||
});
|
||||
Collections.sort(albums, (lhs, rhs) -> {
|
||||
if (lhs.getCloseness() == rhs.getCloseness()) {
|
||||
return 0;
|
||||
} else if (lhs.getCloseness() > rhs.getCloseness()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
|
||||
});
|
||||
Collections.sort(songs, (lhs, rhs) -> {
|
||||
if (lhs.getCloseness() == rhs.getCloseness()) {
|
||||
return 0;
|
||||
} else if (lhs.getCloseness() > rhs.getCloseness()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
|
||||
});
|
||||
|
||||
// Respect counts in search criteria
|
||||
|
|
|
@ -136,13 +136,7 @@ public class CacheCleaner {
|
|||
|
||||
private void sortByAscendingModificationTime(List<File> files) {
|
||||
Collections.sort(files, (a, b) -> {
|
||||
if (a.lastModified() < b.lastModified()) {
|
||||
return -1;
|
||||
}
|
||||
if (a.lastModified() > b.lastModified()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return Long.compare(a.lastModified(), b.lastModified());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue