head

open override val head: E

The first element of this collection.


Calling from Kotlin

Here's an example of calling this property from Kotlin code:

val collection: NotEmptyCollection<Int> = notEmptyListOf(1, 2, 3)
val actual: Int = collection.head
val expected = 1
assertEquals(expected, actual)