Skip to content

Commit ccc3d38

Browse files
authored
Merge pull request #7910 from avently/equalscheck
Better equals check
2 parents 37517c7 + 01e0dd5 commit ccc3d38

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,19 @@ public boolean equals(@Nullable final Object obj) {
528528
return false;
529529
}
530530
final PlayQueue other = (PlayQueue) obj;
531-
return streams.equals(other.streams);
531+
if (size() != other.size()) {
532+
return false;
533+
}
534+
for (int i = 0; i < size(); i++) {
535+
final PlayQueueItem stream = streams.get(i);
536+
final PlayQueueItem otherStream = other.streams.get(i);
537+
// Check is based on serviceId and URL
538+
if (stream.getServiceId() != otherStream.getServiceId()
539+
|| !stream.getUrl().equals(otherStream.getUrl())) {
540+
return false;
541+
}
542+
}
543+
return true;
532544
}
533545

534546
@Override

0 commit comments

Comments
 (0)