4579c9826f
fa500f453dAlex Tkachman Today 19:47725bebc23fAlex Tkachman Today 19:36
11 lines
365 B
Kotlin
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
|
|
}
|