Queue
Your task is to implement the ADS AbstractQueue<E> inside the Queue<E> class provided. You have to
implement all the methods in order to solve the problem, however you are free to add more methods
with any access modifier you want.
void offer (E element) – adds an element at the end of the queue and increases the size.
E poll () – removes and returns the first element at the queue also decreases the size and performs
a check if this method is called upon empty collection if so throw IllegalStateException with message of
your chose the message itself will not be tested.
E peek () – return the element at the current front of the queue if the collection is empty throw
IllegalStateException with appropriate message.
int size () – returns the number of elements inside the stack.
Boolean isEmpty () – returns if the stack contains any elements or not.
Traverse():
Boolean Contains(E element):
Solution:
Offer(E element)
As you can see a lot of the operations described above are a lot like those we did on the Stack problem
so think how you can reuse and modify those. Now you can see slightly different way of adding the
elements in the stack implementation we had pointer to the top element here we have to the first