peek Each
Calls the given function with each item in this deque.
Example 1
val deque = dequeOf(1, 2, 3)
// Prints:
// 1
// 2
// 3
deque.peekEach { println(it) }
require(deque.size == 3)
Content copied to clipboard
Example 2
val deque = dequeOf(1, 2, 3)
// Prints:
// 3
// 2
// 1
deque.peekEach(true) { println(it) }
require(deque.size == 3)
Content copied to clipboard
Parameters
reverse
Whether the iteration should happen in reverse from the back of the deque or forwards from the front of the deque.
fn
Function to call with each item in this deque.