Question: Write a generic Queue class that separates its underlying storage from its interface. This allows you to change the data structure used in the implementation

Write a generic Queue class that separates its underlying storage from its interface. This allows
you to change the data structure used in the implementation without affecting the user, even if
you swap the implementation at runtime. Provide the following methods in your interface:
add enqueues an element
get returns the element expected for FIFO order
remove dequeues an element (FIFO order, of course)
size returns the number of elements in the queue
clear removes all elements from the queue
Note that successive calls to get will return the same element unless remove is called

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!