Fix equals missing in Subnet

This commit is contained in:
Mygod
2017-02-08 18:47:53 +08:00
parent 3ac77e1f8d
commit 293e9b5dff
@@ -1,6 +1,7 @@
package com.github.shadowsocks.acl
import java.net.InetAddress
import java.util.Objects
import com.github.shadowsocks.utils.Utils
@@ -26,6 +27,12 @@ class Subnet(val address: InetAddress, val prefixSize: Int) extends Comparable[S
}
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 {