diff --git a/libraries/stdlib/src/generated/_Filtering.kt b/libraries/stdlib/src/generated/_Filtering.kt index 80c99b6ba71..8ecb6a90913 100644 --- a/libraries/stdlib/src/generated/_Filtering.kt +++ b/libraries/stdlib/src/generated/_Filtering.kt @@ -565,231 +565,231 @@ public fun Stream.filterNotNull(): Stream { } /** - * Appends all elements that are not null to the given *collection* + * Appends all elements that are not null to the given *destination* */ -public fun , T : Any> Array.filterNotNullTo(collection: C): C { - for (element in this) if (element != null) collection.add(element) - return collection +public fun , T : Any> Array.filterNotNullTo(destination: C): C { + for (element in this) if (element != null) destination.add(element) + return destination } /** - * Appends all elements that are not null to the given *collection* + * Appends all elements that are not null to the given *destination* */ -public fun , T : Any> Iterable.filterNotNullTo(collection: C): C { - for (element in this) if (element != null) collection.add(element) - return collection +public fun , T : Any> Iterable.filterNotNullTo(destination: C): C { + for (element in this) if (element != null) destination.add(element) + return destination } /** - * Appends all elements that are not null to the given *collection* + * Appends all elements that are not null to the given *destination* */ -public fun , T : Any> Stream.filterNotNullTo(collection: C): C { - for (element in this) if (element != null) collection.add(element) - return collection +public fun , T : Any> Stream.filterNotNullTo(destination: C): C { + for (element in this) if (element != null) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > Array.filterNotTo(collection: C, predicate: (T) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > Array.filterNotTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > BooleanArray.filterNotTo(collection: C, predicate: (Boolean) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > BooleanArray.filterNotTo(destination: C, predicate: (Boolean) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > ByteArray.filterNotTo(collection: C, predicate: (Byte) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > ByteArray.filterNotTo(destination: C, predicate: (Byte) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > CharArray.filterNotTo(collection: C, predicate: (Char) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > CharArray.filterNotTo(destination: C, predicate: (Char) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > DoubleArray.filterNotTo(collection: C, predicate: (Double) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > DoubleArray.filterNotTo(destination: C, predicate: (Double) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > FloatArray.filterNotTo(collection: C, predicate: (Float) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > FloatArray.filterNotTo(destination: C, predicate: (Float) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > IntArray.filterNotTo(collection: C, predicate: (Int) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > IntArray.filterNotTo(destination: C, predicate: (Int) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > LongArray.filterNotTo(collection: C, predicate: (Long) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > LongArray.filterNotTo(destination: C, predicate: (Long) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > ShortArray.filterNotTo(collection: C, predicate: (Short) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > ShortArray.filterNotTo(destination: C, predicate: (Short) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > Iterable.filterNotTo(collection: C, predicate: (T) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > Iterable.filterNotTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun >> Map.filterNotTo(collection: C, predicate: (Map.Entry) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun >> Map.filterNotTo(destination: C, predicate: (Map.Entry) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all elements not matching the given *predicate* to the given *collection* + * Appends all elements not matching the given *predicate* to the given *destination* */ -public inline fun > Stream.filterNotTo(collection: C, predicate: (T) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.add(element) - return collection +public inline fun > Stream.filterNotTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.add(element) + return destination } /** - * Appends all characters not matching the given *predicate* to the given *collection* + * Appends all characters not matching the given *predicate* to the given *destination* */ -public inline fun String.filterNotTo(collection: C, predicate: (Char) -> Boolean): C { - for (element in this) if (!predicate(element)) collection.append(element) - return collection +public inline fun String.filterNotTo(destination: C, predicate: (Char) -> Boolean): C { + for (element in this) if (!predicate(element)) destination.append(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > Array.filterTo(collection: C, predicate: (T) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > Array.filterTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > BooleanArray.filterTo(collection: C, predicate: (Boolean) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > BooleanArray.filterTo(destination: C, predicate: (Boolean) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > ByteArray.filterTo(collection: C, predicate: (Byte) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > ByteArray.filterTo(destination: C, predicate: (Byte) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > CharArray.filterTo(collection: C, predicate: (Char) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > CharArray.filterTo(destination: C, predicate: (Char) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > DoubleArray.filterTo(collection: C, predicate: (Double) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > DoubleArray.filterTo(destination: C, predicate: (Double) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > FloatArray.filterTo(collection: C, predicate: (Float) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > FloatArray.filterTo(destination: C, predicate: (Float) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > IntArray.filterTo(collection: C, predicate: (Int) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > IntArray.filterTo(destination: C, predicate: (Int) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > LongArray.filterTo(collection: C, predicate: (Long) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > LongArray.filterTo(destination: C, predicate: (Long) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > ShortArray.filterTo(collection: C, predicate: (Short) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > ShortArray.filterTo(destination: C, predicate: (Short) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > Iterable.filterTo(collection: C, predicate: (T) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > Iterable.filterTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun >> Map.filterTo(collection: C, predicate: (Map.Entry) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun >> Map.filterTo(destination: C, predicate: (Map.Entry) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all elements matching the given *predicate* into the given *collection* + * Appends all elements matching the given *predicate* into the given *destination* */ -public inline fun > Stream.filterTo(collection: C, predicate: (T) -> Boolean): C { - for (element in this) if (predicate(element)) collection.add(element) - return collection +public inline fun > Stream.filterTo(destination: C, predicate: (T) -> Boolean): C { + for (element in this) if (predicate(element)) destination.add(element) + return destination } /** - * Appends all characters matching the given *predicate* to the given *collection* + * Appends all characters matching the given *predicate* to the given *destination* */ public inline fun String.filterTo(destination: C, predicate: (Char) -> Boolean): C { for (index in 0..length - 1) { diff --git a/libraries/stdlib/src/generated/_Mapping.kt b/libraries/stdlib/src/generated/_Mapping.kt index 7e91adfde32..3eedff79f2b 100644 --- a/libraries/stdlib/src/generated/_Mapping.kt +++ b/libraries/stdlib/src/generated/_Mapping.kt @@ -99,146 +99,146 @@ public fun Stream.flatMap(transform: (T) -> Stream): Stream { } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > Array.flatMapTo(collection: C, transform: (T) -> Iterable): C { +public inline fun > Array.flatMapTo(destination: C, transform: (T) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > BooleanArray.flatMapTo(collection: C, transform: (Boolean) -> Iterable): C { +public inline fun > BooleanArray.flatMapTo(destination: C, transform: (Boolean) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > ByteArray.flatMapTo(collection: C, transform: (Byte) -> Iterable): C { +public inline fun > ByteArray.flatMapTo(destination: C, transform: (Byte) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > CharArray.flatMapTo(collection: C, transform: (Char) -> Iterable): C { +public inline fun > CharArray.flatMapTo(destination: C, transform: (Char) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > DoubleArray.flatMapTo(collection: C, transform: (Double) -> Iterable): C { +public inline fun > DoubleArray.flatMapTo(destination: C, transform: (Double) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > FloatArray.flatMapTo(collection: C, transform: (Float) -> Iterable): C { +public inline fun > FloatArray.flatMapTo(destination: C, transform: (Float) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > IntArray.flatMapTo(collection: C, transform: (Int) -> Iterable): C { +public inline fun > IntArray.flatMapTo(destination: C, transform: (Int) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > LongArray.flatMapTo(collection: C, transform: (Long) -> Iterable): C { +public inline fun > LongArray.flatMapTo(destination: C, transform: (Long) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > ShortArray.flatMapTo(collection: C, transform: (Short) -> Iterable): C { +public inline fun > ShortArray.flatMapTo(destination: C, transform: (Short) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > Iterable.flatMapTo(collection: C, transform: (T) -> Iterable): C { +public inline fun > Iterable.flatMapTo(destination: C, transform: (T) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > Map.flatMapTo(collection: C, transform: (Map.Entry) -> Iterable): C { +public inline fun > Map.flatMapTo(destination: C, transform: (Map.Entry) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination* */ -public inline fun > String.flatMapTo(collection: C, transform: (Char) -> Iterable): C { +public inline fun > String.flatMapTo(destination: C, transform: (Char) -> Iterable): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** - * Appends all elements yielded from results of *transform* function being invoked on each element of original stream, to the given *collection* + * Appends all elements yielded from results of *transform* function being invoked on each element of original stream, to the given *destination* */ -public inline fun > Stream.flatMapTo(collection: C, transform: (T) -> Stream): C { +public inline fun > Stream.flatMapTo(destination: C, transform: (T) -> Stream): C { for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination } /** @@ -602,171 +602,171 @@ public fun Stream.mapNotNull(transform: (T) -> R): Stream { /** * Appends transformed non-null elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Array.mapNotNullTo(collection: C, transform: (T) -> R): C { +public inline fun > Array.mapNotNullTo(destination: C, transform: (T) -> R): C { for (element in this) { if (element != null) { - collection.add(transform(element)) + destination.add(transform(element)) } } - return collection + return destination } /** * Appends transformed non-null elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Iterable.mapNotNullTo(collection: C, transform: (T) -> R): C { +public inline fun > Iterable.mapNotNullTo(destination: C, transform: (T) -> R): C { for (element in this) { if (element != null) { - collection.add(transform(element)) + destination.add(transform(element)) } } - return collection + return destination } /** * Appends transformed non-null elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Stream.mapNotNullTo(collection: C, transform: (T) -> R): C { +public inline fun > Stream.mapNotNullTo(destination: C, transform: (T) -> R): C { for (element in this) { if (element != null) { - collection.add(transform(element)) + destination.add(transform(element)) } } - return collection + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Array.mapTo(collection: C, transform: (T) -> R): C { +public inline fun > Array.mapTo(destination: C, transform: (T) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > BooleanArray.mapTo(collection: C, transform: (Boolean) -> R): C { +public inline fun > BooleanArray.mapTo(destination: C, transform: (Boolean) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > ByteArray.mapTo(collection: C, transform: (Byte) -> R): C { +public inline fun > ByteArray.mapTo(destination: C, transform: (Byte) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > CharArray.mapTo(collection: C, transform: (Char) -> R): C { +public inline fun > CharArray.mapTo(destination: C, transform: (Char) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > DoubleArray.mapTo(collection: C, transform: (Double) -> R): C { +public inline fun > DoubleArray.mapTo(destination: C, transform: (Double) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > FloatArray.mapTo(collection: C, transform: (Float) -> R): C { +public inline fun > FloatArray.mapTo(destination: C, transform: (Float) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > IntArray.mapTo(collection: C, transform: (Int) -> R): C { +public inline fun > IntArray.mapTo(destination: C, transform: (Int) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > LongArray.mapTo(collection: C, transform: (Long) -> R): C { +public inline fun > LongArray.mapTo(destination: C, transform: (Long) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > ShortArray.mapTo(collection: C, transform: (Short) -> R): C { +public inline fun > ShortArray.mapTo(destination: C, transform: (Short) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Iterable.mapTo(collection: C, transform: (T) -> R): C { +public inline fun > Iterable.mapTo(destination: C, transform: (T) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Map.mapTo(collection: C, transform: (Map.Entry) -> R): C { +public inline fun > Map.mapTo(destination: C, transform: (Map.Entry) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > Stream.mapTo(collection: C, transform: (T) -> R): C { +public inline fun > Stream.mapTo(destination: C, transform: (T) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** * Appends transformed elements of original collection using the given *transform* function - * to the given *collection* + * to the given *destination* */ -public inline fun > String.mapTo(collection: C, transform: (Char) -> R): C { +public inline fun > String.mapTo(destination: C, transform: (Char) -> R): C { for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination } /** diff --git a/libraries/stdlib/src/generated/_SpecialJVM.kt b/libraries/stdlib/src/generated/_SpecialJVM.kt index edefa308e9d..d04935853a5 100644 --- a/libraries/stdlib/src/generated/_SpecialJVM.kt +++ b/libraries/stdlib/src/generated/_SpecialJVM.kt @@ -353,35 +353,35 @@ public fun String.filterIsInstance(klass: Class): List { } /** - * Appends all elements that are instances of specified class into the given *collection* + * Appends all elements that are instances of specified class to the given *destination* */ -public fun , R : T> Array.filterIsInstanceTo(collection: C, klass: Class): C { - for (element in this) if (klass.isInstance(element)) collection.add(element as R) - return collection +public fun , R : T> Array.filterIsInstanceTo(destination: C, klass: Class): C { + for (element in this) if (klass.isInstance(element)) destination.add(element as R) + return destination } /** - * Appends all elements that are instances of specified class into the given *collection* + * Appends all elements that are instances of specified class to the given *destination* */ -public fun , R : T> Iterable.filterIsInstanceTo(collection: C, klass: Class): C { - for (element in this) if (klass.isInstance(element)) collection.add(element as R) - return collection +public fun , R : T> Iterable.filterIsInstanceTo(destination: C, klass: Class): C { + for (element in this) if (klass.isInstance(element)) destination.add(element as R) + return destination } /** - * Appends all elements that are instances of specified class into the given *collection* + * Appends all elements that are instances of specified class to the given *destination* */ -public fun , R : T> Stream.filterIsInstanceTo(collection: C, klass: Class): C { - for (element in this) if (klass.isInstance(element)) collection.add(element as R) - return collection +public fun , R : T> Stream.filterIsInstanceTo(destination: C, klass: Class): C { + for (element in this) if (klass.isInstance(element)) destination.add(element as R) + return destination } /** - * Appends all elements that are instances of specified class into the given *collection* + * Appends all elements that are instances of specified class to the given *destination* */ -public fun , R : Char> String.filterIsInstanceTo(collection: C, klass: Class): C { - for (element in this) if (klass.isInstance(element)) collection.add(element as R) - return collection +public fun , R : Char> String.filterIsInstanceTo(destination: C, klass: Class): C { + for (element in this) if (klass.isInstance(element)) destination.add(element as R) + return destination } /** diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt index a3dc1fcefc7..5ffa35d88ea 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Filtering.kt @@ -208,21 +208,21 @@ fun filtering(): List { include(Maps) } - templates add f("filterTo(collection: C, predicate: (T) -> Boolean)") { + templates add f("filterTo(destination: C, predicate: (T) -> Boolean)") { inline(true) - doc { "Appends all elements matching the given *predicate* into the given *collection*" } + doc { "Appends all elements matching the given *predicate* into the given *destination*" } typeParam("C : TCollection") returns("C") body { """ - for (element in this) if (predicate(element)) collection.add(element) - return collection + for (element in this) if (predicate(element)) destination.add(element) + return destination """ } - doc(Strings) { "Appends all characters matching the given *predicate* to the given *collection*" } + doc(Strings) { "Appends all characters matching the given *predicate* to the given *destination*" } body(Strings) { """ for (index in 0..length - 1) { @@ -265,25 +265,25 @@ fun filtering(): List { include(Maps) } - templates add f("filterNotTo(collection: C, predicate: (T) -> Boolean)") { + templates add f("filterNotTo(destination: C, predicate: (T) -> Boolean)") { inline(true) - doc { "Appends all elements not matching the given *predicate* to the given *collection*" } + doc { "Appends all elements not matching the given *predicate* to the given *destination*" } typeParam("C : TCollection") returns("C") body { """ - for (element in this) if (!predicate(element)) collection.add(element) - return collection + for (element in this) if (!predicate(element)) destination.add(element) + return destination """ } - doc(Strings) { "Appends all characters not matching the given *predicate* to the given *collection*" } + doc(Strings) { "Appends all characters not matching the given *predicate* to the given *destination*" } body(Strings) { """ - for (element in this) if (!predicate(element)) collection.append(element) - return collection + for (element in this) if (!predicate(element)) destination.append(element) + return destination """ } include(Maps) @@ -310,17 +310,17 @@ fun filtering(): List { } } - templates add f("filterNotNullTo(collection: C)") { + templates add f("filterNotNullTo(destination: C)") { exclude(ArraysOfPrimitives, Strings) - doc { "Appends all elements that are not null to the given *collection*" } + doc { "Appends all elements that are not null to the given *destination*" } returns("C") typeParam("C : TCollection") typeParam("T : Any") toNullableT = true body { """ - for (element in this) if (element != null) collection.add(element) - return collection + for (element in this) if (element != null) destination.add(element) + return destination """ } } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt index 48689019e73..55fff0b121a 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Mapping.kt @@ -68,13 +68,13 @@ fun mapping(): List { } } - templates add f("mapTo(collection: C, transform: (T) -> R)") { + templates add f("mapTo(destination: C, transform: (T) -> R)") { inline(true) doc { """ Appends transformed elements of original collection using the given *transform* function - to the given *collection* + to the given *destination* """ } typeParam("R") @@ -84,20 +84,20 @@ fun mapping(): List { body { """ for (item in this) - collection.add(transform(item)) - return collection + destination.add(transform(item)) + return destination """ } include(Maps) } - templates add f("mapNotNullTo(collection: C, transform: (T) -> R)") { + templates add f("mapNotNullTo(destination: C, transform: (T) -> R)") { inline(true) exclude(Strings, ArraysOfPrimitives) doc { """ Appends transformed non-null elements of original collection using the given *transform* function - to the given *collection* + to the given *destination* """ } typeParam("T : Any") @@ -109,10 +109,10 @@ fun mapping(): List { """ for (element in this) { if (element != null) { - collection.add(transform(element)) + destination.add(transform(element)) } } - return collection + return destination """ } } @@ -140,10 +140,10 @@ fun mapping(): List { } } - templates add f("flatMapTo(collection: C, transform: (T) -> Iterable)") { + templates add f("flatMapTo(destination: C, transform: (T) -> Iterable)") { inline(true) exclude(Streams) - doc { "Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *collection*" } + doc { "Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination*" } typeParam("R") typeParam("C : MutableCollection") returns("C") @@ -151,19 +151,19 @@ fun mapping(): List { """ for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination """ } include(Maps) } - templates add f("flatMapTo(collection: C, transform: (T) -> Stream)") { + templates add f("flatMapTo(destination: C, transform: (T) -> Stream)") { inline(true) only(Streams) - doc { "Appends all elements yielded from results of *transform* function being invoked on each element of original stream, to the given *collection*" } + doc { "Appends all elements yielded from results of *transform* function being invoked on each element of original stream, to the given *destination*" } typeParam("R") typeParam("C : MutableCollection") returns("C") @@ -171,9 +171,9 @@ fun mapping(): List { """ for (element in this) { val list = transform(element) - collection.addAll(list) + destination.addAll(list) } - return collection + return destination """ } } diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt index 2ab5f9fceda..6302bf29c38 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/Snapshots.kt @@ -43,13 +43,13 @@ fun snapshots(): List { body { "return toCollection(ArrayList())" } // ISSUE: JavaScript can't perform this operation -/* - body(Collections) { - """ - return ArrayList(this) - """ - } -*/ + /* + body(Collections) { + """ + return ArrayList(this) + """ + } + */ body(ArraysOfObjects, ArraysOfPrimitives) { """ val list = ArrayList(size) @@ -65,18 +65,18 @@ fun snapshots(): List { body { "return toCollection(ArrayList())" } // ISSUE: JavaScript can't perform this operations -/* - body(Collections) { - """ - return ArrayList(this) - """ - } - body(ArraysOfObjects) { - """ - return ArrayList(Arrays.asList(*this)) - """ - } -*/ + /* + body(Collections) { + """ + return ArrayList(this) + """ + } + body(ArraysOfObjects) { + """ + return ArrayList(Arrays.asList(*this)) + """ + } + */ body(ArraysOfPrimitives) { """ val list = ArrayList(size) diff --git a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt index 77df201fbd4..21d128de527 100644 --- a/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt +++ b/libraries/tools/kotlin-stdlib-gen/src/templates/SpecialJVM.kt @@ -73,16 +73,16 @@ fun specialJVM(): List { } } - templates add f("filterIsInstanceTo(collection: C, klass: Class)") { - doc { "Appends all elements that are instances of specified class into the given *collection*" } + templates add f("filterIsInstanceTo(destination: C, klass: Class)") { + doc { "Appends all elements that are instances of specified class to the given *destination*" } typeParam("C : MutableCollection") typeParam("R : T") returns("C") exclude(ArraysOfPrimitives) body { """ - for (element in this) if (klass.isInstance(element)) collection.add(element as R) - return collection + for (element in this) if (klass.isInstance(element)) destination.add(element as R) + return destination """ } }