Introduce plusElement and minusElement to disambiguate situations like List<List<T>> + List<T>
#KT-9992 Fixed
This commit is contained in:
@@ -1599,6 +1599,13 @@ public operator fun <T> Iterable<T>.minus(elements: Sequence<T>): List<T> {
|
||||
return this.filterNot { it in other }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection without the first occurrence of the given [element].
|
||||
*/
|
||||
public fun <T> Iterable<T>.minusElement(element: T): List<T> {
|
||||
return minus(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the original collection into pair of lists,
|
||||
* where *first* list contains elements for which [predicate] yielded `true`,
|
||||
@@ -1706,6 +1713,20 @@ public operator fun <T> Iterable<T>.plus(elements: Sequence<T>): List<T> {
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection and then the given [element].
|
||||
*/
|
||||
public fun <T> Collection<T>.plusElement(element: T): List<T> {
|
||||
return plus(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection and then the given [element].
|
||||
*/
|
||||
public fun <T> Iterable<T>.plusElement(element: T): List<T> {
|
||||
return plus(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of pairs built from elements of both collections with same indexes. List has length of shortest collection.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user