Kotlin
'map.get()' with not-null assertion operator (!!)
Info
Last modified: Last modified: 18 September 2025 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)- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
MapGetWithNotNullAssertionOperator
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
//noinspection MapGetWithNotNullAssertionOperatornote
Actual comment syntax will depend on the code language you are working with
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |