Added tests with type parameter of class in SAM adapter.

This commit is contained in:
Evgeny Gerashchenko
2013-04-17 19:14:54 +04:00
parent e554228a73
commit f4994969c0
6 changed files with 38 additions and 0 deletions
@@ -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"
}