mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
FunctionHelper: fix renaming in lambdas if autogenerated name conflicts with the existing one
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Main {
|
||||
public List<? extends CharSequence> getList() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private void collect() {
|
||||
List<CharSequence> list = new ArrayList<>();
|
||||
for (CharSequence charSequence : getList()) {
|
||||
if (Objects.nonNull(charSequence)) {
|
||||
list.add(charSequence);
|
||||
}
|
||||
}
|
||||
List<? extends CharSequence> res = list;
|
||||
System.out.println(res);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Main {
|
||||
public List<? extends CharSequence> getList() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private void collect() {
|
||||
List<? extends CharSequence> res = getList().stream().filter(Objects::nonNull).col<caret>lect(Collectors.toList());
|
||||
System.out.println(res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user