kittinunf
10/22/2018, 1:26 PMNikky
10/22/2018, 2:09 PMNikky
10/22/2018, 2:10 PMval(request, response, result) = "someUrl".httpGet()
.awaitObjectResponse<SomeType>()
Derk-Jan Karrenbeld
10/22/2018, 2:11 PMNikky
10/22/2018, 2:17 PMDerk-Jan Karrenbeld
10/22/2018, 2:17 PMNikky
10/22/2018, 2:17 PMNikky
10/22/2018, 2:19 PMDerk-Jan Karrenbeld
10/22/2018, 2:19 PMNikky
10/22/2018, 2:20 PMNikky
10/22/2018, 2:21 PMNikky
10/22/2018, 4:30 PMNikky
10/22/2018, 4:31 PMget
, set
with versions that normalize the casing of the stringsDerk-Jan Karrenbeld
10/22/2018, 4:31 PMNikky
10/22/2018, 4:32 PMDerk-Jan Karrenbeld
10/22/2018, 4:32 PMNikky
10/22/2018, 4:34 PMkey.split("-").map { it.lowerCase().capitalize() }.joinToString("-")
Nikky
10/22/2018, 4:34 PMDerk-Jan Karrenbeld
10/22/2018, 4:35 PMDerk-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
.Nikky
10/22/2018, 4:36 PMNikky
10/22/2018, 4:36 PMDerk-Jan Karrenbeld
10/22/2018, 4:37 PMDerk-Jan Karrenbeld
10/22/2018, 4:37 PMNikky
10/22/2018, 4:37 PMDerk-Jan Karrenbeld
10/22/2018, 4:38 PMNikky
10/22/2018, 4:38 PMDerk-Jan Karrenbeld
10/22/2018, 4:38 PMDerk-Jan Karrenbeld
10/22/2018, 5:57 PMNikky
10/22/2018, 6:02 PM