Skip to content

Commit

Permalink
Remove double comparing of content out of the DefaultHttp2GoAwayFrame…
Browse files Browse the repository at this point in the history
….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.
  • Loading branch information
fenik17 authored and normanmaurer committed Sep 7, 2017
1 parent 870b5f5 commit e500755
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,13 @@ public boolean equals(Object o) {
return false;
}
DefaultHttp2GoAwayFrame other = (DefaultHttp2GoAwayFrame) o;
return super.equals(o) && errorCode == other.errorCode && content().equals(other.content())
&& extraStreamIds == other.extraStreamIds;
return errorCode == other.errorCode && extraStreamIds == other.extraStreamIds && super.equals(other);
}

@Override
public int hashCode() {
int hash = 237395317;
int hash = super.hashCode();
hash = hash * 31 + (int) (errorCode ^ (errorCode >>> 32));
hash = hash * 31 + content().hashCode();
hash = hash * 31 + extraStreamIds;
return hash;
}
Expand Down

0 comments on commit e500755

Please sign in to comment.