virajjasani commented on a change in pull request #3199:
URL: https://github.com/apache/ambari/pull/3199#discussion_r436648420



##########
File path: 
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
##########
@@ -137,7 +137,7 @@ public boolean equals(Object o) {
 
     HostStateEntity that = (HostStateEntity) o;
 
-    if (hostId != null ? hostId != that.hostId : that.hostId != null) return 
false;
+    if (hostId != null ? !hostId.equals(that.hostId) : that.hostId != null) 
return false;

Review comment:
       You might prefer using Objects.equals() here

##########
File path: 
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
##########
@@ -137,7 +139,7 @@ public boolean equals(Object o) {
 
     HostStateEntity that = (HostStateEntity) o;
 
-    if (hostId != null ? hostId != that.hostId : that.hostId != null) return 
false;
+    if (hostId != null ? !Objects.equals(hostId, that.hostId) : that.hostId != 
null) return false;

Review comment:
       This can be simplified to:
   ```
   if (!Objects.equals(hostId, that.hostId)){
      retur false;
   }
   ```

##########
File path: 
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
##########
@@ -137,7 +139,7 @@ public boolean equals(Object o) {
 
     HostStateEntity that = (HostStateEntity) o;
 
-    if (hostId != null ? hostId != that.hostId : that.hostId != null) return 
false;
+    if (hostId != null ? !Objects.equals(hostId, that.hostId) : that.hostId != 
null) return false;

Review comment:
       Yes, that would be great




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to