Document the requirement for 'minus(elements)' to have stable hashCode
#KT-24536
This commit is contained in:
@@ -1921,6 +1921,9 @@ public operator fun <T> Iterable<T>.minus(element: T): List<T> {
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection except the elements contained in the given [elements] array.
|
||||
*
|
||||
* The [elements] array may be converted to a [HashSet] to speed up the operation, thus the elements are required to have
|
||||
* a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.
|
||||
*/
|
||||
public operator fun <T> Iterable<T>.minus(elements: Array<out T>): List<T> {
|
||||
if (elements.isEmpty()) return this.toList()
|
||||
@@ -1930,6 +1933,9 @@ public operator fun <T> Iterable<T>.minus(elements: Array<out T>): List<T> {
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection except the elements contained in the given [elements] collection.
|
||||
*
|
||||
* The [elements] collection may be converted to a [HashSet] to speed up the operation, thus the elements are required to have
|
||||
* a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.
|
||||
*/
|
||||
public operator fun <T> Iterable<T>.minus(elements: Iterable<T>): List<T> {
|
||||
val other = elements.convertToSetForSetOperationWith(this)
|
||||
@@ -1940,6 +1946,9 @@ public operator fun <T> Iterable<T>.minus(elements: Iterable<T>): List<T> {
|
||||
|
||||
/**
|
||||
* Returns a list containing all elements of the original collection except the elements contained in the given [elements] sequence.
|
||||
*
|
||||
* The [elements] sequence may be converted to a [HashSet] to speed up the operation, thus the elements are required to have
|
||||
* a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.
|
||||
*/
|
||||
public operator fun <T> Iterable<T>.minus(elements: Sequence<T>): List<T> {
|
||||
val other = elements.toHashSet()
|
||||
|
||||
Reference in New Issue
Block a user