#KT-26965 Add inspection + quickfix for replacing Collection<T>.count() with .size
This commit is contained in:
committed by
Dmitry Gridin
parent
240ff08069
commit
4156a76129
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.ReplaceCollectionCountWithSizeInspection
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var array = arrayOf(1,2,3)
|
||||
array.<caret>count()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var array = arrayOf(1,2,3)
|
||||
array.size
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// PROBLEM: none
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var array = arrayOf(1,2,3)
|
||||
array.<caret>count { i -> i == 1 }
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var list = listOf(1,2,3)
|
||||
list.<caret>count()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var list = listOf(1,2,3)
|
||||
list.size
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var map = mapOf(1 to true)
|
||||
map.<caret>count()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun foo() {
|
||||
var map = mapOf(1 to true)
|
||||
map.size
|
||||
}
|
||||
Reference in New Issue
Block a user