map.getOrDefault(key, defaultValue) 函数调用替换为索引和 elvis 运算符 (map[key] ?: defaultValue)。

示例:


  fun test(map: Map<Int, String>) {
      map.getOrDefault(1, "foo")
  }

  fun test(map: Map<Int, String>) {
      map[1] ?: "foo"
  }