From 8efe2859b843580a31ca3f16331bf792e528b643 Mon Sep 17 00:00:00 2001 From: Eric Xu Date: Fri, 21 May 2021 18:04:22 -0400 Subject: [PATCH] Refactor assignments to field declaration Assignments that don't require the constructor can be moved out. --- .../org/schabi/newpipe/player/playqueue/PlayQueue.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java index f7d70fc34..a5fa949de 100644 --- a/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java +++ b/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java @@ -46,22 +46,21 @@ public abstract class PlayQueue implements Serializable { @NonNull private final AtomicInteger queueIndex; - private final List history; + private final List history = new ArrayList<>(); private transient BehaviorSubject eventBroadcast; private transient Flowable broadcastReceiver; - private transient boolean disposed; + private transient boolean disposed = false; PlayQueue(final int index, final List startWith) { streams = new ArrayList<>(startWith); - history = new ArrayList<>(); + if (streams.size() > index) { history.add(streams.get(index)); } queueIndex = new AtomicInteger(index); - disposed = false; } /*//////////////////////////////////////////////////////////////////////////