CollectMigration: do not wrap nullable values with toUnmodifiableList/Set (IDEA-207976)

This commit is contained in:
Tagir Valeev
2019-03-14 11:10:38 +07:00
parent 6c51666a85
commit 6bef676307
3 changed files with 24 additions and 0 deletions
@@ -3,6 +3,13 @@ import java.util.*;
import java.util.stream.Collectors;
class Test {
List<String> testNullable(List<Integer> input) {
// suppress for nullable
List<String> list = input.stream().map(integer -> integer == null ? null : integer.toString()).collect(Collectors.toList());
return Collections.unmodifiableList(list);
}
List<String> test(String[] list) {
return Arrays.stream(list).filter(s -> !s.isEmpty()).collect(Collectors.toUnmodifiableList());
}
@@ -2,6 +2,16 @@
import java.util.*;
class Test {
List<String> testNullable(List<Integer> input) {
// suppress for nullable
List<String> list = new ArrayList<>();
for (var integer : input) {
list.add(integer == null ? null : integer.toString());
}
return Collections.unmodifiableList(list);
}
List<String> test(String[] list) {
List<String> result = new LinkedList<>();
f<caret>or (int i = 0; i < list.length; i++) {