Compare commits

...

1 Commits

Author SHA1 Message Date
Ilya Gorbunov
5200048d60 Introduce T.addTo(MutableCollection<T>)
#KT-5166 Fixed
2015-12-01 15:30:54 +03:00

View File

@@ -135,6 +135,15 @@ public inline fun <K, V> Map<K, V>.values(): Collection<V> = values
@Deprecated("Use property 'values' instead.", ReplaceWith("values"))
public fun <K, V> MutableMap<K, V>.values(): MutableCollection<V> = values
/**
* Adds this object to the specified [collection].
*
* Can be used with safe call: `nullableValue?.addTo(collectionOfNonNullables)`.
*/
public fun <T> T.addTo(collection: MutableCollection<in T>) {
collection.add(this)
}
/**
* Adds the specified [element] to this mutable collection.
*/