Question: Finish the following methods Queue.java dequeue method This method should remove the item at the front of the queue If there isn't anything in the
Finish the following methods
- Queue.java
- dequeue method
- This method should remove the item at the front of the queue
- If there isn't anything in the queue, it shouldn't crash
- getFront method
- This method should return a pointer to the item at the front of the queue
- Note, this item is NOT removed from the queue
- getFrontAndDequeue method
- This method should return a pointer to the item at the front of the queue
- Note, this item IS removed from the queue
- enqueue method
- This method should add an item to the back of the queue
- isEmpty method
- This method should return true if the queue contains no items, false otherwise
- makeEmpty method
- This method should remove everything from the queue
- dequeue method
public class Queue
public void dequeue() { } public AnyType getFront() { return null; } public AnyType getFrontAndDequeue() { return null; } public void enqueue(AnyType t) { } public boolean isEmpty() { return Math.random() < 0.5; } public void makeEmpty() { }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
