From 889add6848f08014569e17badda3e03f854f4ebb Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 6 Oct 2019 15:00:34 +0200 Subject: [PATCH] More lambdaification --- .../main/java/org/airsonic/player/domain/PlayQueue.java | 2 +- .../java/org/airsonic/player/service/LastFmService.java | 8 +------- .../java/org/airsonic/player/service/PodcastService.java | 2 +- .../java/org/airsonic/player/service/UPnPService.java | 7 +------ 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java b/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java index eac63c6b..a154a9c0 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java +++ b/airsonic-main/src/main/java/org/airsonic/player/domain/PlayQueue.java @@ -278,7 +278,7 @@ public class PlayQueue { } }; - Collections.sort(files, comparator); + files.sort(comparator); if (currentFile != null) { index = files.indexOf(currentFile); } diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java b/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java index 7a0cb8c9..5999b1e8 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/LastFmService.java @@ -19,7 +19,6 @@ package org.airsonic.player.service; -import com.google.common.base.Function; import com.google.common.base.Predicates; import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; @@ -364,12 +363,7 @@ public class LastFmService { Collection matches = Album.search(query.toString(), LAST_FM_KEY); return FluentIterable.from(matches) - .transform(new Function() { - @Override - public LastFmCoverArt apply(Album album) { - return convert(album); - } - }) + .transform(album1 -> convert(album1)) .filter(Predicates.notNull()) .toList(); } catch (Throwable x) { diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java b/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java index eb8e2f7d..5f509c36 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/PodcastService.java @@ -451,7 +451,7 @@ public class PodcastService { } // Sort episode in reverse chronological order (newest first) - Collections.sort(episodes, (a, b) -> { + episodes.sort((a, b) -> { long timeA = a.getPublishDate() == null ? 0L : a.getPublishDate().getTime(); long timeB = b.getPublishDate() == null ? 0L : b.getPublishDate().getTime(); diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java b/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java index 0b4dba6a..70928c25 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/UPnPService.java @@ -76,12 +76,7 @@ public class UPnPService { setMediaServerEnabled(true); } } - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public void run() { - ensureServiceStopped(); - } - }); + Runtime.getRuntime().addShutdownHook(new Thread(() -> ensureServiceStopped())); } public void ensureServiceStarted() {