diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-08-28 15:19:25 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-08-28 15:19:25 -0700 |
commit | c8d6607ecc3a7e2dcdd4c5356325b91b54a4b2ed (patch) | |
tree | dee462597f7bc75c50e563c4f26a1bc8ba41cd06 /src/github | |
parent | 3933c47e9fd74f38caac8f8643e33a8f30fc7220 (diff) | |
download | dsub-c8d6607ecc3a7e2dcdd4c5356325b91b54a4b2ed.tar.gz dsub-c8d6607ecc3a7e2dcdd4c5356325b91b54a4b2ed.tar.bz2 dsub-c8d6607ecc3a7e2dcdd4c5356325b91b54a4b2ed.zip |
Add playlists equals method which allows argument to be id (string)
Diffstat (limited to 'src/github')
-rw-r--r-- | src/github/daneren2005/dsub/domain/Playlist.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/github/daneren2005/dsub/domain/Playlist.java b/src/github/daneren2005/dsub/domain/Playlist.java index 663fa2b0..5bf6753a 100644 --- a/src/github/daneren2005/dsub/domain/Playlist.java +++ b/src/github/daneren2005/dsub/domain/Playlist.java @@ -105,8 +105,24 @@ public class Playlist implements Serializable { this.pub = pub; } - @Override - public String toString() { - return name; - } -}
\ No newline at end of file + @Override + public String toString() { + return name; + } + + @Override + public boolean equals(Object o) { + if(o == this) { + return true; + } else if(o == null) { + return false; + } else if(o instanceof String) { + return o.equals(this.id); + } else if(o.getClass() != getClass()) { + return false; + } + + Playlist playlist = (Playlist) o; + return o.id.equals(this.id); + } +} |