added proper map with default size passed in for Collection/Array but also added to Iterable and java.util.Iterable with no size; so the collection/iterable methods are now I think replicated; just need iterator methods now

This commit is contained in:
James Strachan
2011-12-23 15:52:37 +00:00
parent 877de17122
commit 991a3d9dec
3 changed files with 22 additions and 3 deletions
@@ -0,0 +1,11 @@
// NOTE this file is auto-generated from stdlib/ktSrc/JavaCollections.kt
package std
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> Iterable<T>.map(result: Collection<R> = ArrayList<R>(), transform : (T) -> R) : Collection<R> {
for (item in this)
result.add(transform(item))
return result
}