Slide 7
Slide 7 text
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
public class Task {
final long id;
final String content;
final boolean done;
public Task(long id, String content, boolean done) {
this.id = id;
this.content = content;
this.done = done;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Task task = (Task) o;
return id == task.id &&
done == task.done &&
Objects.equals(content, task.content);
}
@Override
public int hashCode() {
return Objects.hash(id, content, done);
}
@Override
public String toString() {
return "Task{" +
"id=" + id +
", content='" + content + '\'' +
", done=" + done +
'}';
}
}