mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
[java-intention] Create method reference from usage: improve return type guess (IDEA-314907)
GitOrigin-RevId: 2e4e2eb156dcf6e0a739d9efd8b75b398d14ff2f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
31990e349d
commit
ffca32cd79
@@ -0,0 +1,16 @@
|
||||
// "Create method 'getKey'" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class X {
|
||||
void x() {
|
||||
Map<Double, List<String>> map = Stream.of("x").collect(Collectors.groupingBy(this::getKey));
|
||||
}
|
||||
|
||||
private Double getKey(String s) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Create method 'hello'" "true"
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
class X {
|
||||
void x() {
|
||||
BiFunction<String, Integer, Double> fn = (s, i) -> ((double)s.length())/i;
|
||||
BiFunction<String, Integer, Character> fn2 = fn.andThen(X::hello);
|
||||
}
|
||||
|
||||
private static Character hello(Double aDouble) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Create method 'getKey'" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class X {
|
||||
void x() {
|
||||
Map<Double, List<String>> map = Stream.of("x").collect(Collectors.groupingBy(this::<caret>getKey));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Create method 'hello'" "true"
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
class X {
|
||||
void x() {
|
||||
BiFunction<String, Integer, Double> fn = (s, i) -> ((double)s.length())/i;
|
||||
BiFunction<String, Integer, Character> fn2 = fn.andThen(X::<caret>hello);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user