Committed by
Gerrit Code Review
Simplify equals() implementation
Change-Id: I4f0650c8c4f3a50a3132b989e93835c42e92b49b
Showing
1 changed file
with
6 additions
and
9 deletions
| ... | @@ -52,20 +52,17 @@ public class RoleInfo { | ... | @@ -52,20 +52,17 @@ public class RoleInfo { |
| 52 | 52 | ||
| 53 | @Override | 53 | @Override |
| 54 | public boolean equals(Object other) { | 54 | public boolean equals(Object other) { |
| 55 | - if (other == null) { | 55 | + if (this == other) { |
| 56 | - return false; | 56 | + return true; |
| 57 | } | 57 | } |
| 58 | + | ||
| 58 | if (!(other instanceof RoleInfo)) { | 59 | if (!(other instanceof RoleInfo)) { |
| 59 | return false; | 60 | return false; |
| 60 | } | 61 | } |
| 61 | RoleInfo that = (RoleInfo) other; | 62 | RoleInfo that = (RoleInfo) other; |
| 62 | - if (!Objects.equals(this.master, that.master)) { | 63 | + |
| 63 | - return false; | 64 | + return Objects.equals(this.master, that.master) |
| 64 | - } | 65 | + && Objects.equals(this.backups, that.backups); |
| 65 | - if (!Objects.equals(this.backups, that.backups)) { | ||
| 66 | - return false; | ||
| 67 | - } | ||
| 68 | - return true; | ||
| 69 | } | 66 | } |
| 70 | 67 | ||
| 71 | @Override | 68 | @Override | ... | ... |
-
Please register or login to post a comment