stream migration inspection: preserve comments (IDEA-121679)

This commit is contained in:
Anna Kozlova
2014-03-06 15:30:23 +01:00
parent b060c817e0
commit a042720e74
5 changed files with 72 additions and 0 deletions
@@ -0,0 +1,16 @@
// "Replace with collect" "true"
import java.util.*;
import java.util.stream.Collectors;
public class Collect {
class Person {
String getName() {
return "";
}
}
void collectNames(List<Person> persons){
List<String> names = persons.stream().map(Person::getName).collect(Collectors.toList());
//some comment
}
}
@@ -0,0 +1,11 @@
// "Replace with forEach" "true"
import java.util.ArrayList;
import java.util.List;
class Sample {
List<String> foo = new ArrayList<>();
{
//some comment
foo.forEach(System.out::println);
}
}
@@ -0,0 +1,18 @@
// "Replace with collect" "true"
import java.util.*;
public class Collect {
class Person {
String getName() {
return "";
}
}
void collectNames(List<Person> persons){
List<String> names = new ArrayList<>();
for (Person person : pers<caret>ons) {
//some comment
names.add(person.getName());
}
}
}
@@ -0,0 +1,13 @@
// "Replace with forEach" "true"
import java.util.ArrayList;
import java.util.List;
class Sample {
List<String> foo = new ArrayList<>();
{
for (String s : fo<caret>o) {
//some comment
System.out.println(s);
}
}
}