Deprecate mapNotNull to change its behavior later.

#KT-4410
This commit is contained in:
Ilya Gorbunov
2015-10-05 21:05:42 +03:00
parent d7da8b7bd3
commit 0851728454
5 changed files with 14 additions and 4 deletions
@@ -6728,6 +6728,7 @@ public inline fun <R, C : MutableCollection<in R>> ShortArray.mapIndexedTo(desti
/**
* Returns a list containing the results of applying the given [transform] function to each non-null element of the original collection.
*/
@Deprecated("This function will change its semantics soon to map&filter rather than filter&map. Use filterNotNull().map {} instead.", ReplaceWith("filterNotNull().map(transform)"))
public inline fun <T : Any, R> Array<out T?>.mapNotNull(transform: (T) -> R): List<R> {
return mapNotNullTo(ArrayList<R>(), transform)
}
@@ -6736,6 +6737,7 @@ public inline fun <T : Any, R> Array<out T?>.mapNotNull(transform: (T) -> R): Li
* Appends transformed non-null elements of original collection using the given [transform] function
* to the given [destination].
*/
@Deprecated("This function will change its semantics soon to map&filter rather than filter&map. Use filterNotNull().mapTo(destination) {} instead.", ReplaceWith("filterNotNull().mapTo(destination, transform)"))
public inline fun <T : Any, R, C : MutableCollection<in R>> Array<out T?>.mapNotNullTo(destination: C, transform: (T) -> R): C {
for (element in this) {
if (element != null) {