Bo Zhang
12/23/2020, 2:35 PMFunction
parameters?Vampire
12/23/2020, 2:35 PMBo Zhang
12/23/2020, 2:37 PMVampire
12/23/2020, 2:48 PMval f: java.util.function.Function<String, String> = java.util.function.Function { it }
foo.Main.from(f)
res2: kotlin.collections.(Mutable)Map<kotlin.String!, kotlin.String!>! = {}
public static <K, V> Map<K, V> from(Function<K, V> function) {
return emptyMap();
}
Bo Zhang
12/23/2020, 2:55 PMVampire
12/23/2020, 2:55 PMMike Carlin
12/23/2020, 2:57 PMBo Zhang
12/23/2020, 2:58 PMjava.util.function
, you can see that at the top of the source code.Vampire
12/23/2020, 2:59 PMfrom
method expects a Guava Function though, not a Java Functioncom.google.common.cache.CacheLoader.from<String, String> { it }
val f: com.google.common.base.Function<String, String> = com.google.common.base.Function { it }
com.google.common.cache.CacheLoader.from(f)
Bo Zhang
12/23/2020, 3:01 PMVampire
12/23/2020, 3:01 PMephemient
12/23/2020, 3:11 PM