Question: JAVA Implement a generic queue in an ArrayList with the following methods +offer (element: E):void to insert an item at the end of queue +poll():E
JAVA
Implement a generic queue in an ArrayList with the following methods
+offer (element: E):void to insert an item at the end of queue
+poll():E to retrieve and remove an item from the front of queue or null if empty
+peek():E to retrieve without removing an item from front of the queue or null if empty
Also, create a driver to use offer, poll, and peek methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
