Skip to content

Commit

Permalink
distinct books fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ZheniaTrochun committed Jun 15, 2018
1 parent 3e896ac commit 1c67d80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/com/yevhenii/kpi/readmore/model/Book.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,17 @@ public Book(Long id, @NotNull String name, @NotNull String author, Integer year,
}

@Override
public boolean equals(Object o) {
public final boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Book)) return false;
if (!super.equals(o)) return false;
Book book = (Book) o;
return getName().equals(book.getName()) &&
getAuthor().equals(book.getAuthor());
}

@Override
public int hashCode() {
public final int hashCode() {

return Objects.hash(super.hashCode(), getName(), getAuthor());
return Objects.hash(getName(), getAuthor());
}
}

0 comments on commit 1c67d80

Please sign in to comment.