mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 05:09:37 +07:00
lambda -> method ref: compare denotable types (IDEA-153054)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
{
|
||||
List<?> list = new ArrayList<>();
|
||||
list.stream().map(Object::toString);
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,13 @@
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class Collectors2 {
|
||||
static <T> Map<T, Integer> combine(Collection<Map<? extends T, Integer>> pMaps) {
|
||||
return pMaps.stream()
|
||||
.map((Function<Map<? extends T, Integer>, Set<? extends Map.Entry<? extends T, Integer>>>) Map::entrySet)
|
||||
.map(Map::entrySet)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
|
||||
(pEntry1, pEntry2) -> pEntry1 + pEntry2,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class Test {
|
||||
{
|
||||
List<?> list = new ArrayList<>();
|
||||
list.stream().map(o -> o.toStr<caret>ing());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user