This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 4f6b2952776eeb631991e91bc22841731ac64070 Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Wed Dec 11 09:43:34 2019 +0700 [Refactoring] CapabilityResponse: standardize equals and hashCode --- .../imap/message/response/CapabilityResponse.java | 34 +++++++--------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/response/CapabilityResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/message/response/CapabilityResponse.java index 3da1b76..8e8bb7f 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/message/response/CapabilityResponse.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/message/response/CapabilityResponse.java @@ -18,6 +18,7 @@ ****************************************************************/ package org.apache.james.imap.message.response; +import java.util.Objects; import java.util.Set; import org.apache.james.imap.api.message.Capability; @@ -52,33 +53,18 @@ public class CapabilityResponse implements ImapResponseMessage { } @Override - public int hashCode() { - final int PRIME = 31; - int result = 1; - result = PRIME * result + ((capabilities == null) ? 0 : capabilities.hashCode()); - return result; + public final boolean equals(Object o) { + if (o instanceof CapabilityResponse) { + CapabilityResponse that = (CapabilityResponse) o; + + return Objects.equals(this.capabilities, that.capabilities); + } + return false; } @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final CapabilityResponse other = (CapabilityResponse) obj; - if (capabilities == null) { - if (other.capabilities != null) { - return false; - } - } else if (!capabilities.equals(other.capabilities)) { - return false; - } - return true; + public final int hashCode() { + return Objects.hash(capabilities); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org