Commit 293e9b5d authored by Mygod's avatar Mygod

Fix equals missing in Subnet

parent 3ac77e1f
package com.github.shadowsocks.acl package com.github.shadowsocks.acl
import java.net.InetAddress import java.net.InetAddress
import java.util.Objects
import com.github.shadowsocks.utils.Utils import com.github.shadowsocks.utils.Utils
...@@ -26,6 +27,12 @@ class Subnet(val address: InetAddress, val prefixSize: Int) extends Comparable[S ...@@ -26,6 +27,12 @@ class Subnet(val address: InetAddress, val prefixSize: Int) extends Comparable[S
} }
prefixSize compare that.prefixSize prefixSize compare that.prefixSize
} }
override def equals(other: Any): Boolean = other match {
case that: Subnet => address == that.address && prefixSize == that.prefixSize
case _ => false
}
override def hashCode: Int = Objects.hash(address, prefixSize: Integer)
} }
object Subnet { object Subnet {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment