Package dsa.lab03.solutions
Class ArrayQueue<Item>
java.lang.Object
dsa.lab03.solutions.ArrayQueue<Item>
- Type Parameters:
- Item- the item type
An array queue.
 
Implements the queue interface by using a circular dynamic array.
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct an empty array queue.ArrayQueue(Item... items) Construct an array queue containing the given items.ArrayQueue(Iterable<Item> items) Construct an array queue containing the given items.ArrayQueue(Iterable<Item> items, int size) Construct an array queue containing the given items more efficiently thanArrayQueue(Iterable).
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
ArrayQueuepublic ArrayQueue()Construct an empty array queue.
- 
ArrayQueueConstruct an array queue containing the given items.- Parameters:
- items- the items
 
- 
ArrayQueueConstruct an array queue containing the given items more efficiently thanArrayQueue(Iterable).- Parameters:
- items- the items
- size- the number of items
- Throws:
- IllegalArgumentException- if- size!=- n(where- nis- items's size)
 
- 
ArrayQueueConstruct an array queue containing the given items.- Parameters:
- items- the items
 
 
- 
- 
Method Details- 
enqueueDescription copied from interface:QueueEnqueue (insert) the given item to the back.
- 
dequeueDescription copied from interface:QueueDequeue (remove and return) the given item from the front.- Specified by:
- dequeuein interface- Queue<Item>
- Returns:
- the old front item
- Throws:
- NoSuchElementException- if there's no first item to remove (i.e. if this is empty)
 
- 
frontDescription copied from interface:QueueGet the item at the front.- Specified by:
- frontin interface- Queue<Item>
- Returns:
- the front item
- Throws:
- NoSuchElementException- if there's no first item to retrieve (i.e. if this is empty)
 
- 
sizepublic int size()Description copied from interface:ContainerGet the number of contained items.
- 
itemsDescription copied from interface:ContainerGet an iterable that yields each item once.
 
-