Introduce plusElement and minusElement to disambiguate situations like List<List<T>> + List<T>

#KT-9992 Fixed
This commit is contained in:
Ilya Gorbunov
2016-01-26 18:42:30 +03:00
parent fb21ef2e1d
commit 8d02467e6d
10 changed files with 134 additions and 0 deletions
@@ -488,6 +488,14 @@ public inline operator fun ShortArray.plus(elements: ShortArray): ShortArray {
return this.asDynamic().concat(elements)
}
/**
* Returns an array containing all elements of the original array and then the given [element].
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.plusElement(element: T): Array<T> {
return this.asDynamic().concat(arrayOf(element))
}
/**
* Sorts the array in-place.
*/