Add "Replace 'associate' with 'associateBy' or 'associateWith'" inspection
#KT-26269 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
42120b93b8
commit
f1e66d0654
+11
@@ -0,0 +1,11 @@
|
||||
// HIGHLIGHT: INFORMATION
|
||||
// PROBLEM: Replace 'associateTo' with 'associateByTo'
|
||||
// FIX: Replace with 'associateByTo'
|
||||
// WITH_RUNTIME
|
||||
fun getKey(i: Int): Long = 1L
|
||||
fun getValue(i: Int): String = ""
|
||||
|
||||
fun test() {
|
||||
val destination = mutableMapOf<Long, String>()
|
||||
listOf(1).<caret>associateTo(destination) { Pair(getKey(it), getValue(it)) }
|
||||
}
|
||||
Reference in New Issue
Block a user