peek First Or Throw
Returns the first item in this deque if it is not empty, otherwise returns the value returned by the given function.
Example
val deque = dequeOf(1)
assert(deque.peekFirstOrThrow { IllegalStateException() } == 1)
deque.clear()
deque.peekFirstOrThrow { IllegalStateException() } // Exception!
Content copied to clipboard
Return
The first item in this deque if this deque is non-empty.
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.