StreamApiMigrationInspection: improve stream source recognition

This commit is contained in:
Roman
2017-09-27 12:28:23 +07:00
parent 1779a8a871
commit 545ae69261
19 changed files with 571 additions and 30 deletions
@@ -0,0 +1,14 @@
// "Replace with collect" "true"
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class Main {
List<String> test(BufferedReader br) throws IOException {
List<String> result = br.lines().map(String::trim).collect(Collectors.toList());
return result;
}
}
@@ -0,0 +1,14 @@
// "Replace with collect" "true"
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class Main {
List<String> test(BufferedReader br) throws IOException {
List<String> result = br.lines().map(String::trim).collect(Collectors.toList());
return result;
}
}
@@ -0,0 +1,16 @@
// "Replace with collect" "true"
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Main {
List<String> test(BufferedReader br) throws IOException {
List<String> result = new ArrayList<>();
for <caret>(String line = br.readLine(); line != null; line = br.readLine()) {
result.add(line.trim());
}
return result;
}
}
@@ -0,0 +1,16 @@
// "Replace with collect" "true"
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Main {
List<String> test(BufferedReader br) throws IOException {
List<String> result = new ArrayList<>();
for <caret>(String line; (line = br.readLine()) != null; ) {
result.add(line.trim());
}
return result;
}
}