mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
Quick-fix for NPE in method reference to convert to lambda and add ?: (IDEA-176699)
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with ' != null ?:'" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
class A{
|
||||
static String convert(String s) {
|
||||
return s.isEmpty() ? s : null;
|
||||
}
|
||||
|
||||
void test(String[] data){
|
||||
Arrays.stream(data).map(A::convert).map(s -> s != null ? convert(s) : null).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with ' != null ?:'" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
class A{
|
||||
static String convert(String s) {
|
||||
return s.isEmpty() ? s : null;
|
||||
}
|
||||
|
||||
void test(String[] data){
|
||||
Arrays.stream(data).map(A::convert).map(s -> s != null ? s.trim() : null).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with ' != null ?:'" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
class A{
|
||||
static String convert(String s) {
|
||||
return s.isEmpty() ? s : null;
|
||||
}
|
||||
|
||||
void test(String[] data){
|
||||
Arrays.stream(data).map(A::convert).map(A::con<caret>vert).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with ' != null ?:'" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
class A{
|
||||
static String convert(String s) {
|
||||
return s.isEmpty() ? s : null;
|
||||
}
|
||||
|
||||
void test(String[] data){
|
||||
Arrays.stream(data).map(A::convert).map(String::tr<caret>im).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user