JS: create new common directory for all generated tests, migrate several tests there
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package foo
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun <T> ArrayList<T>.findAll(predicate: (T) -> Boolean): ArrayList<T> {
|
||||
val result = ArrayList<T>()
|
||||
for (t in this) {
|
||||
if (predicate(t)) result.add(t)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val list: ArrayList<Int> = ArrayList<Int>()
|
||||
|
||||
list.add(2)
|
||||
list.add(3)
|
||||
list.add(5)
|
||||
|
||||
|
||||
val m: ArrayList<Int> = list.findAll<Int>({ name: Int -> name < 4 })
|
||||
return if (m.size == 2) "OK" else "fail"
|
||||
}
|
||||
Reference in New Issue
Block a user