mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
IDEA-166827 Quick-fix to insert SAM-method call
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// "Insert '.doSomething' to call functional interface method" "true"
|
||||
public class Test {
|
||||
interface MyFn {
|
||||
void doSomething(String s, int i);
|
||||
}
|
||||
|
||||
public void test(MyFn fn) {
|
||||
fn.doSomething();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert '.apply' to call functional interface method" "true"
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Test {
|
||||
public void test(Function<String, String> fn) {
|
||||
String res = fn.apply("foo");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Insert '.test' to call functional interface method" "true"
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Test {
|
||||
public void test(Predicate<String> predicate) {
|
||||
if(predicate.test("foo")) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Insert '.doSomething' to call functional interface method" "true"
|
||||
public class Test {
|
||||
interface MyFn {
|
||||
void doSomething(String s, int i);
|
||||
}
|
||||
|
||||
public void test(MyFn fn) {
|
||||
fn(<caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert '.apply' to call functional interface method" "true"
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Test {
|
||||
public void test(Function<String, String> fn) {
|
||||
String res = f<caret>n("foo");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Insert '.doSomething' to call functional interface method" "false"
|
||||
public class Test {
|
||||
interface MyFn {
|
||||
void doSomething(String s, int i);
|
||||
void doSomething();
|
||||
}
|
||||
|
||||
public void test(MyFn fn) {
|
||||
fn(<caret>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Insert '.test' to call functional interface method" "true"
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class Test {
|
||||
public void test(Predicate<String> predicate) {
|
||||
if(predi<caret>cate("foo")) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user