mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
introduce code block parameter: extract method call with conditional exit
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
import java.util.function.Consumer;
|
||||
|
||||
class Test {
|
||||
void bar() {
|
||||
void bar() {
|
||||
foo(1, new Consumer<Integer>() {
|
||||
public void accept(Integer i) {
|
||||
System.out.println(i);
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import java.util.function.Consumer;
|
||||
|
||||
class Test {
|
||||
void bar() {
|
||||
void bar() {
|
||||
foo(1, new Consumer<Integer>() {
|
||||
public void accept(Integer i) {
|
||||
System.out.println(i);
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import java.util.function.IntPredicate;
|
||||
|
||||
class Test {
|
||||
void bar() {
|
||||
foo(1, new IntPredicate() {
|
||||
public boolean test(int i) {
|
||||
if (i > 0) {
|
||||
System.out.println(i);
|
||||
System.out.println(i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void foo(int i, IntPredicate anObject) {
|
||||
|
||||
if (anObject.test(i)) return;
|
||||
|
||||
System.out.println("Hi");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Test {
|
||||
void bar() {
|
||||
void bar() {
|
||||
foo(new Runnable() {
|
||||
public void run() {
|
||||
System.out.println("");
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
void bar() {
|
||||
foo(1);
|
||||
}
|
||||
|
||||
void foo(int i) {
|
||||
<selection>
|
||||
if (i > 0) {
|
||||
System.out.println(i);
|
||||
System.out.println(i);
|
||||
return;
|
||||
}
|
||||
</selection>
|
||||
System.out.println("Hi");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user