Implemented equals() and hashCode()

This commit is contained in:
dankito 2020-08-08 19:24:18 +02:00
parent ba1b0a27f0
commit bab012a9eb
1 changed files with 19 additions and 0 deletions

View File

@ -11,6 +11,25 @@ open class TanProcedure(
internal constructor() : this("", TanProcedureType.EnterTan, "") // for object deserializers
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is TanProcedure) return false
if (displayName != other.displayName) return false
if (type != other.type) return false
if (bankInternalProcedureCode != other.bankInternalProcedureCode) return false
return true
}
override fun hashCode(): Int {
var result = displayName.hashCode()
result = 31 * result + type.hashCode()
result = 31 * result + bankInternalProcedureCode.hashCode()
return result
}
override fun toString(): String {
return "$displayName ($type, ${bankInternalProcedureCode})"
}