Due: Monday, April 3, 2017, 11:59 pm
The goal of this lab period is to give you an opportunity to implement a queue using your own linked list.
Make a file named MyQueue.java. Declare your class:
public class MyQueue<T> implements
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?
Implement the three interface functions that do not throw exception. The offer method should put the new node on the end of the queue, and the poll methods should remove and return the data in the node at the head of the queue.
Note that you do not need to begin from scratch. Use your LinkedList class from the last project to implement the queue. Your Queue methods can simply call LinkedList methods in the appropriate manner.
Once you are convinced your Queue is working, you may begin Project 6.
© 2017 Ying Li. Page last modified: .