headAndTail

fun <T> List<T>.headAndTail(): Pair<T, List<T>>

Returns the first element paired with a list of the remaining elements.

Throws

if the list is empty.