Provide deprecated unconstrained contains, indexOf, lastIndexOf methods for migration.
This commit is contained in:
@@ -435,6 +435,16 @@ public operator fun ShortArray.contains(element: Short): Boolean {
|
||||
return indexOf(element) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [element] is found in the collection.
|
||||
*/
|
||||
@Deprecated("Use 'containsRaw' instead.", ReplaceWith("containsRaw(element)"))
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public operator fun <T> Array<out T>.contains(element: T): Boolean {
|
||||
return containsRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [element] is found in the collection.
|
||||
* Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`.
|
||||
@@ -1307,6 +1317,17 @@ public fun ShortArray.indexOf(element: Short): Int {
|
||||
return -1
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns first index of [element], or -1 if the collection does not contain element.
|
||||
*/
|
||||
@Deprecated("Use 'indexOfRaw' instead.", ReplaceWith("indexOfRaw(element)"))
|
||||
@kotlin.jvm.JvmName("indexOfAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public fun <T> Array<out T>.indexOf(element: T): Int {
|
||||
return indexOfRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element.
|
||||
*/
|
||||
@@ -1846,6 +1867,17 @@ public fun ShortArray.lastIndexOf(element: Short): Int {
|
||||
return -1
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the collection does not contain element.
|
||||
*/
|
||||
@Deprecated("Use 'indexOfRaw' instead.", ReplaceWith("indexOfRaw(element)"))
|
||||
@kotlin.jvm.JvmName("lastIndexOfAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public fun <T> Array<out T>.lastIndexOf(element: T): Int {
|
||||
return indexOfRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the collection does not contain element.
|
||||
* Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`.
|
||||
|
||||
@@ -61,6 +61,16 @@ public operator fun <T> Iterable<T>.contains(element: @kotlin.internal.NoInfer T
|
||||
return indexOf(element) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [element] is found in the collection.
|
||||
*/
|
||||
@Deprecated("Use 'containsRaw' instead.", ReplaceWith("containsRaw(element)"))
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public operator fun <T> Iterable<T>.contains(element: T): Boolean {
|
||||
return containsRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [element] is found in the collection.
|
||||
* Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`.
|
||||
@@ -260,6 +270,17 @@ public fun <T> Iterable<T>.indexOf(element: @kotlin.internal.NoInfer T): Int {
|
||||
return -1
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns first index of [element], or -1 if the collection does not contain element.
|
||||
*/
|
||||
@Deprecated("Use 'indexOfRaw' instead.", ReplaceWith("indexOfRaw(element)"))
|
||||
@kotlin.jvm.JvmName("indexOfAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public fun <T> Iterable<T>.indexOf(element: T): Int {
|
||||
return indexOfRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element.
|
||||
*/
|
||||
@@ -409,6 +430,17 @@ public fun <T> Iterable<T>.lastIndexOf(element: @kotlin.internal.NoInfer T): Int
|
||||
return lastIndex
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the collection does not contain element.
|
||||
*/
|
||||
@Deprecated("Use 'indexOfRaw' instead.", ReplaceWith("indexOfRaw(element)"))
|
||||
@kotlin.jvm.JvmName("lastIndexOfAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public fun <T> Iterable<T>.lastIndexOf(element: T): Int {
|
||||
return indexOfRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the collection does not contain element.
|
||||
* Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`.
|
||||
|
||||
@@ -19,6 +19,16 @@ public operator fun <T> Sequence<T>.contains(element: @kotlin.internal.NoInfer T
|
||||
return indexOf(element) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [element] is found in the collection.
|
||||
*/
|
||||
@Deprecated("Use 'containsRaw' instead.", ReplaceWith("containsRaw(element)"))
|
||||
@kotlin.jvm.JvmName("containsAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
public operator fun <T> Sequence<T>.contains(element: T): Boolean {
|
||||
return containsRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if [element] is found in the collection.
|
||||
* Allows to overcome type-safety restriction of `contains` that requires to pass an element of type `T`.
|
||||
@@ -132,6 +142,17 @@ public fun <T> Sequence<T>.indexOf(element: @kotlin.internal.NoInfer T): Int {
|
||||
return -1
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns first index of [element], or -1 if the collection does not contain element.
|
||||
*/
|
||||
@Deprecated("Use 'indexOfRaw' instead.", ReplaceWith("indexOfRaw(element)"))
|
||||
@kotlin.jvm.JvmName("indexOfAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public fun <T> Sequence<T>.indexOf(element: T): Int {
|
||||
return indexOfRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element.
|
||||
*/
|
||||
@@ -213,6 +234,17 @@ public fun <T> Sequence<T>.lastIndexOf(element: @kotlin.internal.NoInfer T): Int
|
||||
return lastIndex
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the collection does not contain element.
|
||||
*/
|
||||
@Deprecated("Use 'indexOfRaw' instead.", ReplaceWith("indexOfRaw(element)"))
|
||||
@kotlin.jvm.JvmName("lastIndexOfAny")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public fun <T> Sequence<T>.lastIndexOf(element: T): Int {
|
||||
return indexOfRaw(element)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last index of [element], or -1 if the collection does not contain element.
|
||||
* Allows to overcome type-safety restriction of `lastIndexOf` that requires to pass an element of type `T`.
|
||||
|
||||
Reference in New Issue
Block a user