Files
kotlin-fork/stdlib/ktSrc/JavaCollections.kt
T
Andrey Breslav 4579c9826f Reverting problematic commits:
fa500f453d	Alex Tkachman	Today 19:47
725bebc23f	Alex Tkachman	Today 19:36
2011-12-27 21:26:20 +04:00

11 lines
365 B
Kotlin

package std.util
import java.util.*
/** Returns a new collection containing the results of applying the given function to each element in this collection */
inline fun <T, R> java.util.Collection<T>.map(result: Collection<R> = ArrayList<R>(this.size), transform : (T) -> R) : Collection<R> {
for (item in this)
result.add(transform(item))
return result
}