Say I have a function:
fun doSomething( mapping: Map<String?,Boolean> )
And I have a map:
val mapping = mapOf( "One": true, "Two": false )
I can’t pass it in directly:
Because Kotlin says:
Required: Map<String?,Boolean> Found: Map<String,Boolean>
I understand that a Map<String,Boolean> isn’t strictly the same thing as a Map<String?,Boolean> – so what’s the simplest way to convert the map so that I can pass it in? I feel like there ought to be a simple way to do this, but I haven’t figured out what the simple way is.