mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
[vcs-log] cleanup RootCellRenderer
GitOrigin-RevId: bba216626193ac756cd133b8ae9bc4e577abea42
This commit is contained in:
committed by
intellij-monorepo-bot
parent
dcaeb8f8c7
commit
3fee046d20
+64
@@ -0,0 +1,64 @@
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class MyTest {
|
||||
public static <T, E, A, R> CompletableFuture<R> mapCollect(Iterator<T> iterator, Function<T, CompletableFuture<E>> body, Collector<E, A, R> collector) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Collection<Pair<String, Integer>> test = new ArrayList<>();
|
||||
final CompletableFuture<Map<Object, Object>> future = mapCollect(
|
||||
test.iterator(),
|
||||
e -> CompletableFuture.completedFuture(new Pair(e.getKey(), e.getValue())),
|
||||
Collectors.toMap(
|
||||
e -> e.getKey(),
|
||||
e -> e.getValue()
|
||||
)
|
||||
);
|
||||
future.get();
|
||||
}
|
||||
|
||||
public static void main2(String[] args) throws Exception {
|
||||
Collection<Pair<String, Integer>> test = new ArrayList<>();
|
||||
final CompletableFuture<Map<Object, Object>> future = mapCollect(
|
||||
test.iterator(),
|
||||
e -> CompletableFuture.completedFuture(Pair.of(e.getKey(), e.getValue())),
|
||||
Collectors.toMap(
|
||||
e -> e.getKey(),
|
||||
e -> e.getValue()
|
||||
)
|
||||
);
|
||||
future.get();
|
||||
}
|
||||
|
||||
public static class Pair<K,V> {
|
||||
private final K key;
|
||||
private final V value;
|
||||
|
||||
public Pair(K key, V value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public K getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public V getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static <A, B> Pair<A, B> of(A a, B b) {
|
||||
return new Pair<A,B>(a, b);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
class MyTest {
|
||||
|
||||
{
|
||||
foo(() -> build(id(x -> x)));
|
||||
}
|
||||
|
||||
static <I> I id(I i) {
|
||||
return i;
|
||||
}
|
||||
static <K> void foo(Runnable e) {}
|
||||
|
||||
static <TT> List<TT> build(Function<String, TT> transformers) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class MyTest {
|
||||
|
||||
static class Foo<X> {
|
||||
<T> void test(X x) { }
|
||||
}
|
||||
static class Bar extends Foo<Integer> {
|
||||
void test(Double x) { }
|
||||
|
||||
void call() {
|
||||
test<error descr="Ambiguous method call: both 'Bar.test(Double)' and 'Foo.test(Integer)' match">(null)</error>;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user