From 69103eeffc31511d958d6bfc2124fa3573cafbc4 Mon Sep 17 00:00:00 2001 From: wenshao Date: Wed, 29 Aug 2012 08:21:26 +0800 Subject: [PATCH] add hashcode method --- .../druid/support/http/util/IPAddress.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/alibaba/druid/support/http/util/IPAddress.java b/src/main/java/com/alibaba/druid/support/http/util/IPAddress.java index b0a3b34ce1..a6e2917c8d 100644 --- a/src/main/java/com/alibaba/druid/support/http/util/IPAddress.java +++ b/src/main/java/com/alibaba/druid/support/http/util/IPAddress.java @@ -269,15 +269,12 @@ public class IPAddress implements Cloneable { return result; } + + public int hashCode () { + return this.ipAddress; + } - // ------------------------------------------------------------------------- - /** - * Compare the specified IP address to the encapsulated one. - * - * @param another The IP address to be compared. - * @return Return true if the encapsulated IP address is the same as the specified one, otherwise - * return false. - */ + public boolean equals(Object another) { if (another instanceof IPAddress) { return ipAddress == ((IPAddress) another).ipAddress; @@ -285,12 +282,7 @@ public class IPAddress implements Cloneable { return false; } - // ------------------------------------------------------------------------- - /** - * Clone the encapsulated IP address. - * - * @return Return a new object representing the encapsulated IP address. - */ + public Object clone() { return new IPAddress(ipAddress); }