mirror of
https://gitea.mayex.net/mayekkuzu/Audinaut.git
synced 2025-02-02 21:53:47 +03:00
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) -> {
|
Collections.sort(artists, (lhs, rhs) -> {
|
||||||
if (lhs.getCloseness() == rhs.getCloseness()) {
|
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
|
||||||
return 0;
|
|
||||||
} else if (lhs.getCloseness() > rhs.getCloseness()) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Collections.sort(albums, (lhs, rhs) -> {
|
Collections.sort(albums, (lhs, rhs) -> {
|
||||||
if (lhs.getCloseness() == rhs.getCloseness()) {
|
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
|
||||||
return 0;
|
|
||||||
} else if (lhs.getCloseness() > rhs.getCloseness()) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Collections.sort(songs, (lhs, rhs) -> {
|
Collections.sort(songs, (lhs, rhs) -> {
|
||||||
if (lhs.getCloseness() == rhs.getCloseness()) {
|
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
|
||||||
return 0;
|
|
||||||
} else if (lhs.getCloseness() > rhs.getCloseness()) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Respect counts in search criteria
|
// Respect counts in search criteria
|
||||||
|
@ -136,13 +136,7 @@ public class CacheCleaner {
|
|||||||
|
|
||||||
private void sortByAscendingModificationTime(List<File> files) {
|
private void sortByAscendingModificationTime(List<File> files) {
|
||||||
Collections.sort(files, (a, b) -> {
|
Collections.sort(files, (a, b) -> {
|
||||||
if (a.lastModified() < b.lastModified()) {
|
return Long.compare(a.lastModified(), b.lastModified());
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (a.lastModified() > b.lastModified()) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user