What is an idiomatic way to do `mapOf(...)` with c...
# getting-started
r
What is an idiomatic way to do
mapOf(...)
with conditions on the existence of each pair i.e. something like this obviously broken code:
Copy code
mapOf(
  if(conditionA) "a" to "b",
  if(conditionB) "b" to "c"
)
For a mutable map I could use
apply
but obviously that doesn't work for `mapOf`:
Copy code
mutableMapOf<String, String>().apply {
  if(conditionA) put("a", "b")
  if(conditionB) put("b", "c")
}