- Type Parameters:
E
- type of elements in queue.
- All Superinterfaces:
Iterable<E>
- All Known Subinterfaces:
PriorityQueue<E>
Simple FIFO queue.
This queue is used as an interface to input and output data to the sorters. In particular, queue.put(E t) is used to provide data to the sorter and E queue.get() is used to get the data (in the order required by the comparator).
This queue extends the Iterable
interface,
because it makes checking for ordered-ness particularly easy with assertJ.
The developer may choose the best queue implementation for its sort strategy. Note that singly-linked queues can be more space efficient than doubly linked queues.
- Author:
- Pieter van den Hombergh
-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
put
Add element to the end of queue.- Parameters:
element
- to add
-
get
E get()Remove element of front of the queue and return it.- Returns:
- the first element in this queue, or null if queue is empty.
-
isEmpty
boolean isEmpty()Checks if queue is empty.- Returns:
- true if empty, false if not.
-
size
long size()The number of elements contained in this queue.- Returns:
- the number of elements.
-