Simplify equals() implementation
Change-Id: I4f0650c8c4f3a50a3132b989e93835c42e92b49b
diff --git a/core/api/src/main/java/org/onosproject/cluster/RoleInfo.java b/core/api/src/main/java/org/onosproject/cluster/RoleInfo.java
index 1601dad..081a6ba 100644
--- a/core/api/src/main/java/org/onosproject/cluster/RoleInfo.java
+++ b/core/api/src/main/java/org/onosproject/cluster/RoleInfo.java
@@ -52,20 +52,17 @@
@Override
public boolean equals(Object other) {
- if (other == null) {
- return false;
+ if (this == other) {
+ return true;
}
+
if (!(other instanceof RoleInfo)) {
return false;
}
RoleInfo that = (RoleInfo) other;
- if (!Objects.equals(this.master, that.master)) {
- return false;
- }
- if (!Objects.equals(this.backups, that.backups)) {
- return false;
- }
- return true;
+
+ return Objects.equals(this.master, that.master)
+ && Objects.equals(this.backups, that.backups);
}
@Override