queueOf

fun <T> queueOf(vararg values: T): Queue<T>

Creates a new Queue instance wrapping the given values.

The created queue will have an initial capacity equal to the number of args passed.

Example:

val queue = queueOf(1, 2, 3)

queue.next() // 1
queue.next() // 2
queue.next() // 3

Return

A new queue wrapping the given values.

Parameters

values

Values to append to the newly created queue.


fun <T> queueOf(values: Iterable<T>): Queue<T>

Creates a new Queue instance wrapping the given values.

Example:

val queue = queueOf(listOf(1, 2, 3))

queue.next() // 1
queue.next() // 2
queue.next() // 3

Return

A new queue wrapping the given values.

Parameters

values

Values to append to the newly created queue.