Supported simplest cases of SAM adapter in backend.

This commit is contained in:
Evgeny Gerashchenko
2013-04-16 19:17:46 +04:00
parent c5b9c6a7dc
commit 7bd11718de
9 changed files with 99 additions and 6 deletions
@@ -0,0 +1,7 @@
import java.util.*;
class JavaClass {
public static void sortIntList(List<Integer> list, Comparator<Integer> comparator) {
Collections.sort(list, comparator);
}
}
@@ -0,0 +1,8 @@
import java.util.*
fun box(): String {
val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5))
val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1))
JavaClass.sortIntList(list, { a, b -> b - a })
return if (list == expected) "OK" else list.toString()
}
@@ -0,0 +1,7 @@
import java.io.*;
class JavaClass {
public static String invokeFilter(FileFilter f, File file1, File file2) {
return f.accept(file1) + " " + f.accept(file2);
}
}
@@ -0,0 +1,11 @@
import java.io.*
fun box(): String {
val ACCEPT_NAME = "test"
val WRONG_NAME = "wrong"
val result = JavaClass.invokeFilter({ file -> ACCEPT_NAME == file?.getName() }, File(ACCEPT_NAME), File(WRONG_NAME))
if (result != "true false") return "Wrong result: $result"
return "OK"
}
@@ -0,0 +1,5 @@
class JavaClass {
public static void run(Runnable r) {
r.run();
}
}
@@ -0,0 +1,5 @@
fun box(): String {
var v = "FAIL"
JavaClass.run { v = "OK" }
return v
}