Added tests with type parameter of class in SAM adapter.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import java.util.*;
|
||||
|
||||
class WeirdComparator<T> {
|
||||
public T max(Comparator<T> comparator, T value1, T value2) {
|
||||
return comparator.compare(value1, value2) > 0 ? value1 : value2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun box(): String {
|
||||
val wc = WeirdComparator<String>()
|
||||
val result = wc.max({ a, b -> a.length - b.length }, "java", "kotlin")
|
||||
if (result != "kotlin") return "Wrong: $result"
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user