Class QueueService<T>
java.lang.Object
com.iu.javadatastructureslab.services.QueueService<T>
- Type Parameters:
T- element type
- Direct Known Subclasses:
ShopQueueService
Simple priority-aware queue wrapper for demo purposes.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
QueueService
public QueueService()
-
-
Method Details
-
enqueue
Adds an item to the queue, placing priority items at the front.- Parameters:
item- element to enqueuepriority- priority flag (0 for normal, >0 for priority)
-
dequeue
Removes and returns the first element in the queue.- Returns:
- dequeued element
- Throws:
NoSuchElementException- when the queue is empty
-
clear
public void clear()Clears all elements from the queue. -
getQueue
Returns the underlying queue instance.- Returns:
- backing deque
-