KT 13962: Intention to replace Java collection constructor calls with function calls from stdlib (ArrayList() → arrayListOf())

This commit is contained in:
Austaon
2019-03-15 14:05:47 +01:00
committed by Mikhail Glukhikh
parent bbeb65905e
commit 0e716fd528
18 changed files with 161 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ConvertCollectionConstructorToFunction
@@ -0,0 +1,5 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
fun foo() {
var list: ArrayList<Int> = <caret>ArrayList(3)
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
var list: ArrayList<Int> = <caret>ArrayList()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
var list: ArrayList<Int> = arrayListOf()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
var list = <caret>ArrayList<Int>()
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
var list = arrayListOf<Int>()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
import java.util.HashMap
fun foo() {
var list: HashMap<Int, Int> = <caret>HashMap()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
import java.util.HashMap
fun foo() {
var list: HashMap<Int, Int> = hashMapOf()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
import java.util.HashSet
fun foo() {
var list: HashSet<Int> = <caret>HashSet()
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
import java.util.HashSet
fun foo() {
var list: HashSet<Int> = hashSetOf()
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.LinkedHashSet
fun foo() {
var list: LinkedHashSet<Int> = <caret>LinkedHashSet()
}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
import java.util.LinkedHashSet
fun foo() {
var list: LinkedHashSet<Int> = linkedSetOf()
}