need Override equals and hashCode method 33/109433/1
authorTaka Cho <takamune.cho@att.com>
Mon, 22 Jun 2020 20:17:07 +0000 (16:17 -0400)
committerTaka Cho <takamune.cho@att.com>
Mon, 22 Jun 2020 20:18:59 +0000 (16:18 -0400)
Use eclipse to generate those two
Overrides in order to avoid sonar
issue

Issue-ID: POLICY-2616
Change-Id: If7e887b99fa44dac5ac5fa6f8c8cfe677238576d
Signed-off-by: Taka Cho <takamune.cho@att.com>
feature-server-pool/src/main/java/org/onap/policy/drools/serverpool/Server.java

index 511b79a..c60683e 100644 (file)
@@ -215,6 +215,23 @@ public class Server implements Comparable<Server> {
         return Util.uuidComparator.compare(uuid, other.uuid);
     }
 
+    @Override
+    public int hashCode() {
+        return Objects.hash(uuid);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof Server)) {
+            return false;
+        }
+        Server other = (Server) obj;
+        return Objects.equals(uuid, other.uuid);
+    }
+
     /**
      * This method may be invoked from any thread, and is used as the main
      * entry point when testing.