Package com.javaholics
Interface QueueInterface<T>
- Type Parameters:
T
- The type of the objects in the queue.
- All Known Implementing Classes:
LinkedQueue
public interface QueueInterface<T>
An interface for the ADT queue.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all entries from this queue.dequeue()
Removes and returns the entry at the front of this queue.void
Adds a new entry to the back of this queue.getFront()
Retrieves the entry at the front of this queue.boolean
isEmpty()
Checks whether this queue is empty.
-
Method Details
-
enqueue
Adds a new entry to the back of this queue.- Parameters:
newEntry
- The entry to add to the queue.
-
dequeue
T dequeue()Removes and returns the entry at the front of this queue.- Returns:
- The entry at the front of the queue.
-
getFront
T getFront()Retrieves the entry at the front of this queue.- Returns:
- The entry at the front of the queue.
-
isEmpty
boolean isEmpty()Checks whether this queue is empty.- Returns:
- True if the queue is empty, false otherwise.
-
clear
void clear()Removes all entries from this queue. The queue will be empty after this method returns.
-