Hah, discovered why this works, due to an interest...
# android
a
Hah, discovered why this works, due to an interesting bit of Kotlin trivia. Who knows why?
Copy code
private fun mapIt(key: String, value: String?): HashMap<String, String> {
        val map = HashMap<String, String>()
        map.put(key, value) // won’t compile
        return map
    }
    private fun mapIt2(key: String, value: String?): HashMap<String, String> {
        val map = HashMap<String, String>()
        map.put(key, value.toString()) // compiles
        return map
    }