Due: , 11:59 pm
The goal of this lab period is to give you an opportunity to implement a node-based queue.
Make a file named MyQueue.java. Declare your class:
public class MyQueue<T> implements Iterable<T>
Note: Although we are using Java's Queue interface as inspiration, we are not going to implement all of the methods in that interface (specifically, we are ignoring the larger set of Collections methods), so we will not say that our class "implements Queue". It will, however, implement Iterable.
Find the Queue interface documentation and see what the key functions are. What is the difference between them?
4. Implement the three interface functions that do not throw exception. The offer method should put the new node on the end (tail) of the queue, and the poll methods should remove and return the data in the node at the front (head) of the queue.
You should be able to copy significant amounts of code from your LinkedList.
When you are done with the lab exercises, you may start on the rest of the project.
© 2018 Caitrin Eaton.