mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
StreamToLoopInspection: added ExplicitCollectTerminalOperation; StreamVariable simplified; guard checks added (IDEA-CR-15249)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Main {
|
||||
private static void test(List<String> list) {
|
||||
String result = list.stream().filter(Objects::nonNull).coll<caret>ect(StringBuilder::new, (sb, str) -> sb.append(str), StringBuilder::append).toString();
|
||||
System.out.println(result);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
test(Arrays.asList("aa", "bbb", "c", null, "dd"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user