mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
IDEA-200455 Suggest to replace (a, b) -> a + b lambdas with Integer::sum, Long::sum, Double::sum
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.IntBinaryOperator;
|
||||
|
||||
class Bar {
|
||||
public void test(Object obj) {
|
||||
IntBinaryOperator op = Integer::sum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
class Bar {
|
||||
interface Foo {
|
||||
int sum(Byte b1, Byte b2);
|
||||
}
|
||||
|
||||
public void test(Object obj) {
|
||||
Foo foo = Integer::sum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.LongBinaryOperator;
|
||||
|
||||
class Bar {
|
||||
public void test(Object obj) {
|
||||
LongBinaryOperator op = Long::sum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.IntBinaryOperator;
|
||||
|
||||
class Bar {
|
||||
public void test(Object obj) {
|
||||
IntBinaryOperator op = (a, b) -> (a) + <caret>b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
class Bar {
|
||||
interface Foo {
|
||||
int sum(Byte b1, Byte b2);
|
||||
}
|
||||
|
||||
public void test(Object obj) {
|
||||
Foo foo = (b1, b2) -> b1<caret> + b2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.LongBinaryOperator;
|
||||
|
||||
class Bar {
|
||||
public void test(Object obj) {
|
||||
LongBinaryOperator op = (a, b) -> b + <caret>a;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user