mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-17 20:11:25 +07:00
lambda -> method ref: allow pure method call chain (IDEA-164223)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
final Test test = new Test();
|
||||
final List<Sub> subs = Arrays.asList(new Sub(), new Sub());
|
||||
|
||||
subs.forEach(test.getSubs()::add);
|
||||
}
|
||||
|
||||
private static class Test {
|
||||
private final List<Sub> subs = new ArrayList<>();
|
||||
|
||||
private List<Sub> getSubs() {
|
||||
return subs;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Sub {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
final Test test = new Test();
|
||||
final List<Sub> subs = Arrays.asList(new Sub(), new Sub());
|
||||
|
||||
subs.forEach(t -> test.getSubs().a<caret>dd(t));
|
||||
}
|
||||
|
||||
private static class Test {
|
||||
private final List<Sub> subs = new ArrayList<>();
|
||||
|
||||
private List<Sub> getSubs() {
|
||||
return subs;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Sub {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user