penultimate

fun <T> List<T>.penultimate(): T

Returns the element before the last one.

Throws

if the list has fewer than two elements.