From de9e666493469d40fa9107a78f9ae421a05f9cf4 Mon Sep 17 00:00:00 2001 From: Nikolay Fedorovskikh Date: Fri, 8 Sep 2017 00:48:35 +0500 Subject: [PATCH] Fix hashCode() in Http2StreamChannelId Motivation: In `Http2StreamChannelId` a `hashCode()` is not consistent with `equals()`. Modifications: Make a `Http2StreamChannelId.hashCode()` consistent with `equals()`. Result: Faster hash map's operations where the Http2StreamChannelId as keys. --- .../java/io/netty/handler/codec/http2/Http2StreamChannelId.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelId.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelId.java index ebdc0cdaaf34..5cb32255e0dc 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelId.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2StreamChannelId.java @@ -56,7 +56,7 @@ public int compareTo(ChannelId o) { @Override public int hashCode() { - return parentId.hashCode(); + return id * 31 + parentId.hashCode(); } @Override