Use lambda

This commit is contained in:
Andrew Rabert 2018-04-24 20:10:11 -04:00
parent 99c03d59b3
commit ff8862c723
2 changed files with 4 additions and 12 deletions

View File

@ -227,15 +227,9 @@ public class OfflineMusicService implements MusicService {
} }
} }
Collections.sort(artists, (lhs, rhs) -> { Collections.sort(artists, (lhs, rhs) -> Integer.compare(rhs.getCloseness(), lhs.getCloseness()));
return Integer.compare(rhs.getCloseness(), lhs.getCloseness()); Collections.sort(albums, (lhs, rhs) -> Integer.compare(rhs.getCloseness(), lhs.getCloseness()));
}); Collections.sort(songs, (lhs, rhs) -> Integer.compare(rhs.getCloseness(), lhs.getCloseness()));
Collections.sort(albums, (lhs, rhs) -> {
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
});
Collections.sort(songs, (lhs, rhs) -> {
return Integer.compare(rhs.getCloseness(), lhs.getCloseness());
});
// Respect counts in search criteria // Respect counts in search criteria
int artistCount = Math.min(artists.size(), criteria.getArtistCount()); int artistCount = Math.min(artists.size(), criteria.getArtistCount());

View File

@ -135,9 +135,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) -> Long.compare(a.lastModified(), b.lastModified()));
return Long.compare(a.lastModified(), b.lastModified());
});
} }
private Set<File> findUndeletableFiles() { private Set<File> findUndeletableFiles() {