peek First Or Get
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.peekFirstOrGet { 6 } == 1)
deque.clear()
assert(deque.peekFirstOrGet { 6 } == 6)
Content copied to clipboard
Return
Either the first item in this deque if this deque is non-empty, or the value returned by fn if this deque is empty.
Parameters
fn
Function that will be used to retrieve the value to return when this deque is empty.
This function will not be called if this deque is not empty.