mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
stream migration inspection: collapse only primitive new initializers (IDEA-121745)
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
// "Replace with collect" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Collect {
|
||||
class Person {
|
||||
String getName() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> foo() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
void collectNames(List<Person> persons){
|
||||
List<String> names = foo();
|
||||
names.addAll(persons.stream().map(Person::getName).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// "Replace with collect" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Collect {
|
||||
class Person {
|
||||
String getName() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<String> foo() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
void collectNames(List<Person> persons){
|
||||
List<String> names = foo();
|
||||
for (Person person : pers<caret>ons) {
|
||||
names.add(person.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user