Reorder items according to their index numbers.
Determine whether buffer is empty, i.e. all items emitted.
Return number of items in buffer.
Add a new item.
Return and remove in-order items.
Reorder items according to their index numbers.