J2K: Fix type parameters in LHS of callable reference
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// RUNTIME_WITH_FULL_JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestLambda<T> {
|
||||
public static class Box<Q> {
|
||||
|
||||
private Q value;
|
||||
public Q unbox() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Box(Q q) {
|
||||
value = q;
|
||||
}
|
||||
}
|
||||
|
||||
public String toStringAllBox(List<Box<T>> list) {
|
||||
return list.stream().map(Box<T>::unbox).map(T::toString).reduce((s1,s2) -> s1 + ", " + s2 ).orElse("");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class TestLambda<T> {
|
||||
class Box<Q>(private val value: Q) {
|
||||
fun unbox(): Q {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
fun toStringAllBox(list: List<Box<T>>): String {
|
||||
return list.stream().map { obj: Box<T> -> obj.unbox() }.map { obj: T -> obj.toString() }
|
||||
.reduce { s1: String, s2: String -> "$s1, $s2" }.orElse("")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user