Rename "collection" parameter to "destination" in *To() functions.

This commit is contained in:
Ilya Ryzhenkov
2014-04-15 16:01:51 +04:00
committed by Andrey Breslav
parent e43d08d228
commit 6562ee4967
7 changed files with 300 additions and 300 deletions
+113 -113
View File
@@ -565,231 +565,231 @@ public fun <T : Any> Stream<T?>.filterNotNull(): Stream<T> {
}
/**
* Appends all elements that are not null to the given *collection*
* Appends all elements that are not null to the given *destination*
*/
public fun <C : MutableCollection<in T>, T : Any> Array<T?>.filterNotNullTo(collection: C): C {
for (element in this) if (element != null) collection.add(element)
return collection
public fun <C : MutableCollection<in T>, T : Any> Array<T?>.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 <C : MutableCollection<in T>, T : Any> Iterable<T?>.filterNotNullTo(collection: C): C {
for (element in this) if (element != null) collection.add(element)
return collection
public fun <C : MutableCollection<in T>, T : Any> Iterable<T?>.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 <C : MutableCollection<in T>, T : Any> Stream<T?>.filterNotNullTo(collection: C): C {
for (element in this) if (element != null) collection.add(element)
return collection
public fun <C : MutableCollection<in T>, T : Any> Stream<T?>.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 <T, C : MutableCollection<in T>> Array<out T>.filterNotTo(collection: C, predicate: (T) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <T, C : MutableCollection<in T>> Array<out T>.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 <C : MutableCollection<in Boolean>> BooleanArray.filterNotTo(collection: C, predicate: (Boolean) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Boolean>> 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 <C : MutableCollection<in Byte>> ByteArray.filterNotTo(collection: C, predicate: (Byte) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Byte>> 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 <C : MutableCollection<in Char>> CharArray.filterNotTo(collection: C, predicate: (Char) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Char>> 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 <C : MutableCollection<in Double>> DoubleArray.filterNotTo(collection: C, predicate: (Double) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Double>> 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 <C : MutableCollection<in Float>> FloatArray.filterNotTo(collection: C, predicate: (Float) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Float>> 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 <C : MutableCollection<in Int>> IntArray.filterNotTo(collection: C, predicate: (Int) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Int>> 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 <C : MutableCollection<in Long>> LongArray.filterNotTo(collection: C, predicate: (Long) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Long>> 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 <C : MutableCollection<in Short>> ShortArray.filterNotTo(collection: C, predicate: (Short) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Short>> 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 <T, C : MutableCollection<in T>> Iterable<T>.filterNotTo(collection: C, predicate: (T) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <T, C : MutableCollection<in T>> Iterable<T>.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 <K, V, C : MutableCollection<in Map.Entry<K, V>>> Map<K, V>.filterNotTo(collection: C, predicate: (Map.Entry<K, V>) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <K, V, C : MutableCollection<in Map.Entry<K, V>>> Map<K, V>.filterNotTo(destination: C, predicate: (Map.Entry<K, V>) -> 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 <T, C : MutableCollection<in T>> Stream<T>.filterNotTo(collection: C, predicate: (T) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.add(element)
return collection
public inline fun <T, C : MutableCollection<in T>> Stream<T>.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 <C : Appendable> String.filterNotTo(collection: C, predicate: (Char) -> Boolean): C {
for (element in this) if (!predicate(element)) collection.append(element)
return collection
public inline fun <C : Appendable> 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 <T, C : MutableCollection<in T>> Array<out T>.filterTo(collection: C, predicate: (T) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <T, C : MutableCollection<in T>> Array<out T>.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 <C : MutableCollection<in Boolean>> BooleanArray.filterTo(collection: C, predicate: (Boolean) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Boolean>> 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 <C : MutableCollection<in Byte>> ByteArray.filterTo(collection: C, predicate: (Byte) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Byte>> 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 <C : MutableCollection<in Char>> CharArray.filterTo(collection: C, predicate: (Char) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Char>> 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 <C : MutableCollection<in Double>> DoubleArray.filterTo(collection: C, predicate: (Double) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Double>> 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 <C : MutableCollection<in Float>> FloatArray.filterTo(collection: C, predicate: (Float) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Float>> 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 <C : MutableCollection<in Int>> IntArray.filterTo(collection: C, predicate: (Int) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Int>> 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 <C : MutableCollection<in Long>> LongArray.filterTo(collection: C, predicate: (Long) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Long>> 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 <C : MutableCollection<in Short>> ShortArray.filterTo(collection: C, predicate: (Short) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <C : MutableCollection<in Short>> 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 <T, C : MutableCollection<in T>> Iterable<T>.filterTo(collection: C, predicate: (T) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <T, C : MutableCollection<in T>> Iterable<T>.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 <K, V, C : MutableCollection<in Map.Entry<K, V>>> Map<K, V>.filterTo(collection: C, predicate: (Map.Entry<K, V>) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <K, V, C : MutableCollection<in Map.Entry<K, V>>> Map<K, V>.filterTo(destination: C, predicate: (Map.Entry<K, V>) -> 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 <T, C : MutableCollection<in T>> Stream<T>.filterTo(collection: C, predicate: (T) -> Boolean): C {
for (element in this) if (predicate(element)) collection.add(element)
return collection
public inline fun <T, C : MutableCollection<in T>> Stream<T>.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 <C : Appendable> String.filterTo(destination: C, predicate: (Char) -> Boolean): C {
for (index in 0..length - 1) {
+116 -116
View File
@@ -99,146 +99,146 @@ public fun <T, R> Stream<T>.flatMap(transform: (T) -> Stream<R>): Stream<R> {
}
/**
* 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 <T, R, C : MutableCollection<in R>> Array<out T>.flatMapTo(collection: C, transform: (T) -> Iterable<R>): C {
public inline fun <T, R, C : MutableCollection<in R>> Array<out T>.flatMapTo(destination: C, transform: (T) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> BooleanArray.flatMapTo(collection: C, transform: (Boolean) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> BooleanArray.flatMapTo(destination: C, transform: (Boolean) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> ByteArray.flatMapTo(collection: C, transform: (Byte) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> ByteArray.flatMapTo(destination: C, transform: (Byte) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> CharArray.flatMapTo(collection: C, transform: (Char) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> CharArray.flatMapTo(destination: C, transform: (Char) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> DoubleArray.flatMapTo(collection: C, transform: (Double) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> DoubleArray.flatMapTo(destination: C, transform: (Double) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> FloatArray.flatMapTo(collection: C, transform: (Float) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> FloatArray.flatMapTo(destination: C, transform: (Float) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> IntArray.flatMapTo(collection: C, transform: (Int) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> IntArray.flatMapTo(destination: C, transform: (Int) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> LongArray.flatMapTo(collection: C, transform: (Long) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> LongArray.flatMapTo(destination: C, transform: (Long) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> ShortArray.flatMapTo(collection: C, transform: (Short) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> ShortArray.flatMapTo(destination: C, transform: (Short) -> Iterable<R>): 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 <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(collection: C, transform: (T) -> Iterable<R>): C {
public inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(destination: C, transform: (T) -> Iterable<R>): 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 <K, V, R, C : MutableCollection<in R>> Map<K, V>.flatMapTo(collection: C, transform: (Map.Entry<K, V>) -> Iterable<R>): C {
public inline fun <K, V, R, C : MutableCollection<in R>> Map<K, V>.flatMapTo(destination: C, transform: (Map.Entry<K, V>) -> Iterable<R>): 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 <R, C : MutableCollection<in R>> String.flatMapTo(collection: C, transform: (Char) -> Iterable<R>): C {
public inline fun <R, C : MutableCollection<in R>> String.flatMapTo(destination: C, transform: (Char) -> Iterable<R>): 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 <T, R, C : MutableCollection<in R>> Stream<T>.flatMapTo(collection: C, transform: (T) -> Stream<R>): C {
public inline fun <T, R, C : MutableCollection<in R>> Stream<T>.flatMapTo(destination: C, transform: (T) -> Stream<R>): 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 <T : Any, R> Stream<T?>.mapNotNull(transform: (T) -> R): Stream<R> {
/**
* Appends transformed non-null elements of original collection using the given *transform* function
* to the given *collection*
* to the given *destination*
*/
public inline fun <T : Any, R, C : MutableCollection<in R>> Array<T?>.mapNotNullTo(collection: C, transform: (T) -> R): C {
public inline fun <T : Any, R, C : MutableCollection<in R>> Array<T?>.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 <T : Any, R, C : MutableCollection<in R>> Iterable<T?>.mapNotNullTo(collection: C, transform: (T) -> R): C {
public inline fun <T : Any, R, C : MutableCollection<in R>> Iterable<T?>.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 <T : Any, R, C : MutableCollection<in R>> Stream<T?>.mapNotNullTo(collection: C, transform: (T) -> R): C {
public inline fun <T : Any, R, C : MutableCollection<in R>> Stream<T?>.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 <T, R, C : MutableCollection<in R>> Array<out T>.mapTo(collection: C, transform: (T) -> R): C {
public inline fun <T, R, C : MutableCollection<in R>> Array<out T>.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 <R, C : MutableCollection<in R>> BooleanArray.mapTo(collection: C, transform: (Boolean) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> ByteArray.mapTo(collection: C, transform: (Byte) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> CharArray.mapTo(collection: C, transform: (Char) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> DoubleArray.mapTo(collection: C, transform: (Double) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> FloatArray.mapTo(collection: C, transform: (Float) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> IntArray.mapTo(collection: C, transform: (Int) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> LongArray.mapTo(collection: C, transform: (Long) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <R, C : MutableCollection<in R>> ShortArray.mapTo(collection: C, transform: (Short) -> R): C {
public inline fun <R, C : MutableCollection<in R>> 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 <T, R, C : MutableCollection<in R>> Iterable<T>.mapTo(collection: C, transform: (T) -> R): C {
public inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.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 <K, V, R, C : MutableCollection<in R>> Map<K, V>.mapTo(collection: C, transform: (Map.Entry<K, V>) -> R): C {
public inline fun <K, V, R, C : MutableCollection<in R>> Map<K, V>.mapTo(destination: C, transform: (Map.Entry<K, V>) -> 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 <T, R, C : MutableCollection<in R>> Stream<T>.mapTo(collection: C, transform: (T) -> R): C {
public inline fun <T, R, C : MutableCollection<in R>> Stream<T>.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 <R, C : MutableCollection<in R>> String.mapTo(collection: C, transform: (Char) -> R): C {
public inline fun <R, C : MutableCollection<in R>> String.mapTo(destination: C, transform: (Char) -> R): C {
for (item in this)
collection.add(transform(item))
return collection
destination.add(transform(item))
return destination
}
/**
+16 -16
View File
@@ -353,35 +353,35 @@ public fun <R : Char> String.filterIsInstance(klass: Class<R>): List<R> {
}
/**
* 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 <T, C : MutableCollection<in R>, R : T> Array<out T>.filterIsInstanceTo(collection: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
return collection
public fun <T, C : MutableCollection<in R>, R : T> Array<out T>.filterIsInstanceTo(destination: C, klass: Class<R>): 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 <T, C : MutableCollection<in R>, R : T> Iterable<T>.filterIsInstanceTo(collection: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
return collection
public fun <T, C : MutableCollection<in R>, R : T> Iterable<T>.filterIsInstanceTo(destination: C, klass: Class<R>): 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 <T, C : MutableCollection<in R>, R : T> Stream<T>.filterIsInstanceTo(collection: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
return collection
public fun <T, C : MutableCollection<in R>, R : T> Stream<T>.filterIsInstanceTo(destination: C, klass: Class<R>): 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 <C : MutableCollection<in R>, R : Char> String.filterIsInstanceTo(collection: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) collection.add(element as R)
return collection
public fun <C : MutableCollection<in R>, R : Char> String.filterIsInstanceTo(destination: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) destination.add(element as R)
return destination
}
/**