Fix implementation of Iterable<T>.take

#KT-4780 Fixed
This commit is contained in:
Alexander Udalov
2014-03-28 15:45:28 +04:00
parent 829cd95469
commit e3fffe275b
3 changed files with 21 additions and 8 deletions
@@ -51,9 +51,11 @@ fun filtering(): List<GenericFunction> {
"""
var count = 0
val list = ArrayList<T>(n)
for (item in this)
for (item in this) {
if (count++ >= n)
list.add(item)
break
list.add(item)
}
return list
"""
}