StreamApiMigration: register comments from post-loop operations like sorting

This commit is contained in:
Tagir Valeev
2018-06-27 09:29:38 +07:00
parent 09da3fa9a4
commit bd4a3477f5
7 changed files with 22 additions and 14 deletions
@@ -5,6 +5,9 @@ import java.util.stream.Stream;
public class Test {
public void testSetListSort(String[] args) {
// foo
// bar
/*baz*/
System.out.println(Arrays.stream(args).distinct().sorted().toArray());
}
}
@@ -6,8 +6,8 @@ import java.util.stream.Stream;
public class Test {
public void testSetListSort(String[] args) {
Set<String> set = Arrays.stream(args).co<caret>llect(Collectors.toSet());
List<String> list = new ArrayList<>(set);
list.sort(null);
System.out.println(list.toArray());
List<String> list = new ArrayList<>(set); // foo
list.sort(null); // bar
System.out.println(list.toArray(/*baz*/));
}
}
@@ -10,6 +10,7 @@ public class Collect {
}
void collectNames(List<Person> persons){
List<String> names = persons.stream().map(Person::getName).sorted(Comparator.comparing(Person::getName)).collect(Collectors.toList());
List<String> names = persons.stream().map(Person::getName).sorted(Comparator.comparing(/*c2*/Person::getName)).collect(Collectors.toList());
// comment
}
}
@@ -13,6 +13,7 @@ public class Collect {
for (Person person : pers<caret>ons) {
names.add(person.getName());
}
Collections.sort(names, Comparator.comparing(Person::getName));
Collections.// comment
sort(names, Comparator.comparing(/*c2*/Person::getName));
}
}