mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-24 12:29:25 +00:00
fix: implement hashcode and equals to make pollers unique in concurrent hash map
This commit is contained in:
@@ -22,4 +22,25 @@ class SessionId {
|
||||
}
|
||||
|
||||
fun hexString() = prefix?.value + publicKey
|
||||
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SessionId
|
||||
|
||||
if (prefix != other.prefix) return false
|
||||
if (publicKey != other.publicKey) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = prefix?.hashCode() ?: 0
|
||||
result = 31 * result + publicKey.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user