Skip to content

Commit

Permalink
Change shuffle() guard to check for size <= 2
Browse files Browse the repository at this point in the history
After testing the app, I realized that shuffling a queue with size 2
does nothing
  • Loading branch information
imericxu committed May 23, 2021
1 parent 930f0a6 commit 89423a8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,12 @@ public synchronized void unsetRecovery(final int index) {
* Will emit a {@link ReorderEvent} if shuffled.
* </p>
*
* @implNote Does nothing if the queue is empty or has a size of 1
* @implNote Does nothing if the queue has a size <= 2 (the currently playing video must stay on
* top, so shuffling a size-2 list does nothing)
*/
public synchronized void shuffle() {
// Can't shuffle an list that's empty or only has one element
if (size() <= 1) {
if (size() <= 2) {
return;
}
// Create a backup if it doesn't already exist
Expand Down

0 comments on commit 89423a8

Please sign in to comment.