withoutLast

fun <E2> List<E2>.withoutLast(): List<E2>

Produce a new immutable list based on the given list, but with the last element excluded. Try to avoid creating new objects if possible.

Receiver

The original list.

Return

An immutable list containing all but the last element of the original.

Parameters

E2

The list's element type.