From 4789cf6c3161419cfb353fc8be658a352ad62261 Mon Sep 17 00:00:00 2001 From: Stypox Date: Sat, 19 Feb 2022 18:01:04 +0100 Subject: [PATCH] Use Java streams in AbstractInfoPlayQueue --- .../newpipe/player/playqueue/AbstractInfoPlayQueue.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java index dc1c960cb..df2747c3b 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/AbstractInfoPlayQueue.java @@ -9,8 +9,8 @@ import org.schabi.newpipe.extractor.ListInfo; import org.schabi.newpipe.extractor.Page; import org.schabi.newpipe.extractor.stream.StreamInfoItem; -import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import io.reactivex.rxjava3.core.SingleObserver; import io.reactivex.rxjava3.disposables.Disposable; @@ -132,10 +132,6 @@ abstract class AbstractInfoPlayQueue> } private static List extractListItems(final List infoItems) { - final List result = new ArrayList<>(); - for (final StreamInfoItem stream : infoItems) { - result.add(new PlayQueueItem(stream)); - } - return result; + return infoItems.stream().map(PlayQueueItem::new).collect(Collectors.toList()); } }