popFirstOrThrow

fun popFirstOrThrow(fn: () -> Throwable): T

Removes the first item from this deque and returns it.

Example

val deque = dequeOf(1)

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

Return

The value that was previously the first 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.