Fix typo
This commit is contained in:
committed by
Andrey Breslav
parent
89c1260627
commit
e43d08d228
@@ -431,70 +431,70 @@ public inline fun String.first(predicate: (Char) -> Boolean): Char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun <T> Array<out T>.firstOrNull(): T? {
|
public fun <T> Array<out T>.firstOrNull(): T? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun BooleanArray.firstOrNull(): Boolean? {
|
public fun BooleanArray.firstOrNull(): Boolean? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun ByteArray.firstOrNull(): Byte? {
|
public fun ByteArray.firstOrNull(): Byte? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun CharArray.firstOrNull(): Char? {
|
public fun CharArray.firstOrNull(): Char? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun DoubleArray.firstOrNull(): Double? {
|
public fun DoubleArray.firstOrNull(): Double? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun FloatArray.firstOrNull(): Float? {
|
public fun FloatArray.firstOrNull(): Float? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun IntArray.firstOrNull(): Int? {
|
public fun IntArray.firstOrNull(): Int? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun LongArray.firstOrNull(): Long? {
|
public fun LongArray.firstOrNull(): Long? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun ShortArray.firstOrNull(): Short? {
|
public fun ShortArray.firstOrNull(): Short? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun <T> Iterable<T>.firstOrNull(): T? {
|
public fun <T> Iterable<T>.firstOrNull(): T? {
|
||||||
when (this) {
|
when (this) {
|
||||||
@@ -514,14 +514,14 @@ public fun <T> Iterable<T>.firstOrNull(): T? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun <T> List<T>.firstOrNull(): T? {
|
public fun <T> List<T>.firstOrNull(): T? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun <T> Stream<T>.firstOrNull(): T? {
|
public fun <T> Stream<T>.firstOrNull(): T? {
|
||||||
when (this) {
|
when (this) {
|
||||||
@@ -541,7 +541,7 @@ public fun <T> Stream<T>.firstOrNull(): T? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns first elementm, or null if collection is empty
|
* Returns first element, or null if collection is empty
|
||||||
*/
|
*/
|
||||||
public fun String.firstOrNull(): Char? {
|
public fun String.firstOrNull(): Char? {
|
||||||
return if (size > 0) this[0] else null
|
return if (size > 0) this[0] else null
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ fun elements(): List<GenericFunction> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
templates add f("firstOrNull()") {
|
templates add f("firstOrNull()") {
|
||||||
doc { "Returns first elementm, or null if collection is empty" }
|
doc { "Returns first element, or null if collection is empty" }
|
||||||
returns("T?")
|
returns("T?")
|
||||||
body {
|
body {
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user