Remove unnecessary equals and hashcode overriden methods.
package com.baeldung.concurrent.atomic;
-import java.util.Objects;
import java.util.concurrent.atomic.AtomicMarkableReference;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -18,23 +17,20 @@ public class AtomicMarkableReferenceUnitTest {
this.name = name;
}
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
+ public int getId() {
+ return id;
}
- if (obj == null) {
- return false;
+
+ public void setId(int id) {
+ this.id = id;
}
- if (!(obj instanceof Employee))
- return false;
- Employee employee = (Employee) obj;
- return id == employee.id && name.equals(employee.name);
+
+ public String getName() {
+ return name;
}
- @Override
- public int hashCode() {
- return Objects.hash(id, name);
+ public void setName(String name) {
+ this.name = name;
}
}
