last

fun <T> Sequence<T>.last(): T(source)

Returns the last element.

The operation is terminal.

Since Kotlin

1.0

Throws

if the sequence is empty.

Samples


inline fun <T> Sequence<T>.last(predicate: (T) -> Boolean): T(source)

Returns the last element matching the given predicate.

The operation is terminal.

Since Kotlin

1.0

Throws

if no such element is found.

Samples