Inspectopedia Help

'map.get()' with not-null assertion operator (!!)

Reports map.get()!! that can be replaced with map.getValue(), map.getOrElse(), and so on.

Example:

fun test(map: Map<Int, String>): String = map.get(0)!!

After the quick-fix is applied:

fun test(map: Map<Int, String>): String = map.getValue(0)

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023