check instanceof Movie
This commit is contained in:
parent
b0e5cff217
commit
80e0f8b2e6
@ -12,6 +12,10 @@ public boolean equals(Object other) {
|
|||||||
if (other == null) {
|
if (other == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!(other instanceof Movie)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Movie movie = (Movie) other;
|
Movie movie = (Movie) other;
|
||||||
if (movie.name.equals(this.name) && movie.yearOfRelease.equals(this.yearOfRelease)) {
|
if (movie.name.equals(this.name) && movie.yearOfRelease.equals(this.yearOfRelease)) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user