mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 00:11:26 +07:00
AdjustFunctionContextFix: suggest to change method accepting lambda/methodRef
Fixes cases 1, 2 from IDEA-174219 Add quick-fixes for incompilable Stream API call chains when using primitive streams
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace 'flatMap()' with 'flatMapToDouble()'" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
double[][] data = {{0,1,2},{3,4,5}};
|
||||
Arrays.stream(data).flatMapToDouble(array -> Arrays.stream(array)).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace 'flatMap()' with 'flatMapToInt()'" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
int[][] data = {{0,1,2},{3,4,5}};
|
||||
Arrays.stream(data).flatMapToInt(Arrays::stream).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'map()' with 'mapToDouble()'" "true"
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
IntStream.range(0, 100).mapToDouble(x -> x/1.0).forEach(s -> System.out.println(s));
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'map()' with 'mapToObj()'" "true"
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
IntStream.range(0, 100).mapToObj(String::valueOf).forEach(s -> System.out.println(s));
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'mapToInt()' with 'map()'" "true"
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
LongStream.range(0, 100).map(x -> x*2).forEach(s -> System.out.println(s));
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace 'flatMap()' with 'flatMapToDouble()'" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
double[][] data = {{0,1,2},{3,4,5}};
|
||||
Arrays.stream(data).flatMap(array -> Arrays.<caret>stream(array)).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace 'flatMap()' with 'flatMapToInt()'" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
int[][] data = {{0,1,2},{3,4,5}};
|
||||
Arrays.stream(data).flatMap(Arrays<caret>::stream).forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'map()' with 'mapToDouble()'" "true"
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
IntStream.range(0, 100).map(x -> x/<caret>1.0).forEach(s -> System.out.println(s));
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'map()' with 'mapToObj()'" "true"
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
IntStream.range(0, 100).map(String<caret>::valueOf).forEach(s -> System.out.println(s));
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Replace 'mapToInt()' with 'map()'" "true"
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
void test() {
|
||||
LongStream.range(0, 100).mapToInt(x -> x<caret>*2).forEach(s -> System.out.println(s));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user