Checking type of the collection being iterated

This commit is contained in:
Valentin Kipyatkov
2016-05-11 22:26:51 +03:00
parent 89dab52a14
commit 394cce8e10
9 changed files with 96 additions and 4 deletions
+12
View File
@@ -0,0 +1,12 @@
// WITH_RUNTIME
import java.util.ArrayList
fun foo(array: IntArray): List<Int> {
val result = ArrayList<Int>()
<caret>for (i in array) {
if (i % 3 == 0) {
result.add(i)
}
}
return result
}