Refactor PlaylistTab.equals
This commit is contained in:
parent
1812249d37
commit
2fc26bc154
1 changed files with 14 additions and 7 deletions
|
@ -600,15 +600,22 @@ public abstract class Tab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (!(super.equals(obj)
|
if (!(obj instanceof PlaylistTab)) {
|
||||||
&& Objects.equals(playlistType, ((PlaylistTab) obj).playlistType)
|
return false;
|
||||||
&& Objects.equals(playlistName, ((PlaylistTab) obj).playlistName))) {
|
|
||||||
return false; // base objects are different
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (playlistId == ((PlaylistTab) obj).playlistId) // local
|
final PlaylistTab other = (PlaylistTab) obj;
|
||||||
|| (playlistServiceId == ((PlaylistTab) obj).playlistServiceId // remote
|
|
||||||
&& Objects.equals(playlistUrl, ((PlaylistTab) obj).playlistUrl));
|
if (!(super.equals(obj))) {
|
||||||
|
// Base objects are different
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return playlistServiceId == other.playlistServiceId // Remote
|
||||||
|
&& playlistId == other.playlistId // Local
|
||||||
|
&& playlistUrl.equals(other.playlistUrl)
|
||||||
|
&& playlistName.equals(other.playlistName)
|
||||||
|
&& playlistType == other.playlistType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPlaylistServiceId() {
|
public int getPlaylistServiceId() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue