mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
Fix IDEA-165466 Stream API migration: automatically simplify emptyList().stream() to empty()
SimplifyStreamApiCallChainsInspection refactoring: simplifyCollectionStreamCalls extracted;
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Main {
|
||||
private void collect() {
|
||||
Set<String> res = Stream.of("a", "b", "c").filter(s -> !s.isEmpty()).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Main {
|
||||
private void collect() {
|
||||
Set<String> res = Stream.<String>empty().filter(s -> !s.isEmpty()).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
private void collect() {
|
||||
Set<String> res = new HashSet<>();
|
||||
for (String s : Arrays.<caret>asList("a", "b", "c")) {
|
||||
if (!s.isEmpty())
|
||||
res.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
private void collect() {
|
||||
Set<String> res = new HashSet<>();
|
||||
for (String s : Collections.<String><caret>emptyList()) {
|
||||
if (!s.isEmpty())
|
||||
res.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user