Generate *Raw methods.

This commit is contained in:
Ilya Gorbunov
2015-10-15 19:59:54 +03:00
parent 8aed39d9bb
commit 683bc4bd01
4 changed files with 120 additions and 0 deletions
+24
View File
@@ -435,6 +435,14 @@ public operator fun ShortArray.contains(element: Short): Boolean {
return indexOf(element) >= 0
}
/**
* Returns `true` if [element] is found in the collection.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.containsRaw(element: Any?): Boolean {
return contains<Any?>(element)
}
/**
* Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection.
*/
@@ -1514,6 +1522,14 @@ public inline fun ShortArray.indexOfLast(predicate: (Short) -> Boolean): Int {
return -1
}
/**
* Returns first index of [element], or -1 if the collection does not contain element.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.indexOfRaw(element: Any?): Int {
return indexOf<Any?>(element)
}
/**
* Returns the last element.
* @throws [NoSuchElementException] if the collection is empty.
@@ -1828,6 +1844,14 @@ public fun ShortArray.lastIndexOf(element: Short): Int {
return -1
}
/**
* Returns last index of [element], or -1 if the collection does not contain element.
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun <T> Array<out T>.lastIndexOfRaw(element: Any?): Int {
return lastIndexOf<Any?>(element)
}
/**
* Returns the last element, or `null` if the collection is empty.
*/