Remove double comparing of content out of the DefaultHttp2GoAwayFrame.equals()

Motivation:
In `DefaultHttp2GoAwayFrame.equals()` a content compared twice: explicitly and in the `super` method.

Modifications:
Remove explicit content comparision.
Make `hashCode()` consistent with `equals()`.

Result:
A `DefaultHttp2GoAwayFrame.equals()` work faster.
This commit is contained in:
Nikolay Fedorovskikh 2017-09-07 00:00:21 +05:00 committed by Norman Maurer
parent 870b5f5e4b
commit e500755086

View File

@ -160,15 +160,13 @@ public final class DefaultHttp2GoAwayFrame extends DefaultByteBufHolder implemen
return false; return false;
} }
DefaultHttp2GoAwayFrame other = (DefaultHttp2GoAwayFrame) o; DefaultHttp2GoAwayFrame other = (DefaultHttp2GoAwayFrame) o;
return super.equals(o) && errorCode == other.errorCode && content().equals(other.content()) return errorCode == other.errorCode && extraStreamIds == other.extraStreamIds && super.equals(other);
&& extraStreamIds == other.extraStreamIds;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 237395317; int hash = super.hashCode();
hash = hash * 31 + (int) (errorCode ^ (errorCode >>> 32)); hash = hash * 31 + (int) (errorCode ^ (errorCode >>> 32));
hash = hash * 31 + content().hashCode();
hash = hash * 31 + extraStreamIds; hash = hash * 31 + extraStreamIds;
return hash; return hash;
} }