Solution (source code)

= Solution

A node needs a stored value and one successor reference:

``
final class QueueNode(val value: Int, var next: QueueNode)
``

A null successor terminates the chain. The stored value need not be mutable for a <FIFO queue>, because enqueue creates a node and dequeue removes one rather than changing its payload.