first

Common
JVM
JS
Native
1.0
fun < T > Array < out T > . first ( ) : T
(source)
fun ByteArray . first ( ) : Byte
(source)
fun ShortArray . first ( ) : Short
(source)
fun IntArray . first ( ) : Int
(source)
fun LongArray . first ( ) : Long
(source)
fun FloatArray . first ( ) : Float
(source)
fun DoubleArray . first ( ) : Double
(source)
fun BooleanArray . first ( ) : Boolean
(source)
fun CharArray . first ( ) : Char
(source)
@ExperimentalUnsignedTypes fun UIntArray . first ( ) : UInt
(source)
@ExperimentalUnsignedTypes fun ULongArray . first ( ) : ULong
(source)
@ExperimentalUnsignedTypes fun UByteArray . first ( ) : UByte
(source)
@ExperimentalUnsignedTypes fun UShortArray . first ( ) : UShort
(source)

Returns the first element.

Exceptions

NoSuchElementException - if the array is empty.

Common
JVM
JS
Native
1.0
inline fun < T > Array < out T > . first (
predicate : ( T ) -> Boolean
) : T

(source)
inline fun ByteArray . first (
predicate : ( Byte ) -> Boolean
) : Byte

(source)
inline fun ShortArray . first (
predicate : ( Short ) -> Boolean
) : Short

(source)
inline fun IntArray . first ( predicate : ( Int ) -> Boolean ) : Int
(source)
inline fun LongArray . first (
predicate : ( Long ) -> Boolean
) : Long

(source)
inline fun FloatArray . first (
predicate : ( Float ) -> Boolean
) : Float

(source)
inline fun DoubleArray . first (
predicate : ( Double ) -> Boolean
) : Double

(source)
inline fun BooleanArray . first (
predicate : ( Boolean ) -> Boolean
) : Boolean

(source)
inline fun CharArray . first (
predicate : ( Char ) -> Boolean
) : Char

(source)
inline fun < T > Iterable < T > . first (
predicate : ( T ) -> Boolean
) : T

(source)
@ExperimentalUnsignedTypes inline fun UIntArray . first (
predicate : ( UInt ) -> Boolean
) : UInt

(source)
@ExperimentalUnsignedTypes inline fun ULongArray . first (
predicate : ( ULong ) -> Boolean
) : ULong

(source)
@ExperimentalUnsignedTypes inline fun UByteArray . first (
predicate : ( UByte ) -> Boolean
) : UByte

(source)
@ExperimentalUnsignedTypes inline fun UShortArray . first (
predicate : ( UShort ) -> Boolean
) : UShort

(source)

Returns the first element matching the given predicate .

Exceptions

NoSuchElementException - if no such element is found.

Common
JVM
JS
Native
1.0
fun < T > Iterable < T > . first ( ) : T
(source)

Returns the first element.

Exceptions

NoSuchElementException - if the collection is empty.

Common
JVM
JS
Native
1.0
fun < T > List < T > . first ( ) : T
(source)

Returns the first element.

Exceptions

NoSuchElementException - if the list is empty.