Added 'public' annotation and specified return types for library functions
This commit is contained in:
@@ -15,12 +15,12 @@ import java.util.*
|
||||
*
|
||||
* @includeFunction ../../test/CollectionTest.kt map
|
||||
*/
|
||||
inline fun <T, R> Array<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
public inline fun <T, R> Array<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
return mapTo(java.util.ArrayList<R>(this.size), transform)
|
||||
}
|
||||
|
||||
/** Transforms each element of this collection with the given function then adds the results to the given collection */
|
||||
inline fun <T, R, C: Collection<in R>> Array<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
public inline fun <T, R, C: Collection<in R>> Array<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
for (item in this)
|
||||
result.add(transform(item))
|
||||
return result
|
||||
|
||||
@@ -15,12 +15,12 @@ import java.util.*
|
||||
*
|
||||
* @includeFunction ../../test/CollectionTest.kt map
|
||||
*/
|
||||
inline fun <T, R> java.lang.Iterable<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
public inline fun <T, R> java.lang.Iterable<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
return mapTo(java.util.ArrayList<R>(), transform)
|
||||
}
|
||||
|
||||
/** Transforms each element of this collection with the given function then adds the results to the given collection */
|
||||
inline fun <T, R, C: Collection<in R>> java.lang.Iterable<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
public inline fun <T, R, C: Collection<in R>> java.lang.Iterable<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
for (item in this)
|
||||
result.add(transform(item))
|
||||
return result
|
||||
|
||||
@@ -15,12 +15,12 @@ import java.util.*
|
||||
*
|
||||
* @includeFunction ../../test/CollectionTest.kt map
|
||||
*/
|
||||
inline fun <T, R> Iterable<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
public inline fun <T, R> Iterable<T>.map(transform : (T) -> R) : java.util.List<R> {
|
||||
return mapTo(java.util.ArrayList<R>(), transform)
|
||||
}
|
||||
|
||||
/** Transforms each element of this collection with the given function then adds the results to the given collection */
|
||||
inline fun <T, R, C: Collection<in R>> Iterable<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
public inline fun <T, R, C: Collection<in R>> Iterable<T>.mapTo(result: C, transform : (T) -> R) : C {
|
||||
for (item in this)
|
||||
result.add(transform(item))
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user