Derk-Jan Karrenbeld
10/22/2018, 4:35 PMdata class HeaderName(val name: String) {
private val normalized = name.toUpperCase()
override fun hashCode(): Int {
return normalized.hashCode()
}
override fun equals(other: Any?): Boolean {
return (other is HeaderName) && other.normalized === normalized
}
}
HeaderName(key)
can now be used as HashMap accessor and it will JustWork™, because HashMap uses hashCode
.