popLastOrThrow

Removes the last item from this deque and returns it.

Example

val deque = dequeOf(1)

assert(deque.popLastOrThrow { RuntimeException() } == 1)
deque.popLastOrThrow { RuntimeException() } // Exception!

Return

The value that was previously the last item in this deque.

Parameters

fn

Function that will be used to retrieve the exception to throw when this deque is empty.

This function will not be called if this deque is not empty.

Throws

If this deque is empty.