mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
inspection to highlight and convert pseudo-functional code (like guava Iterables) to java 8 api. initial version
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.base.Predicate;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.Collections;
|
||||
|
||||
class c {
|
||||
void m() {
|
||||
Iterables.al<caret>l(Collections.emptyList(), getPredicate(100));
|
||||
}
|
||||
|
||||
public Predicate<String> getPredicate(final int param) {
|
||||
final MyComplexPredicate predicate = new MyComplexPredicate(param);
|
||||
predicate.setParam2(200);
|
||||
return predicate;
|
||||
}
|
||||
|
||||
class MyComplexPredicate extends Predicate<String> {
|
||||
int param;
|
||||
int param2;
|
||||
|
||||
public MyComplexPredicate(int param) {
|
||||
this.param = param;
|
||||
}
|
||||
|
||||
public void setParam2(int param2) {
|
||||
this.param2 = param2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(String input) {
|
||||
System.out.println("lambda param " + param);
|
||||
doMagic();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void doMagic() {
|
||||
//do something
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user