Package utilities
Interface QueueADT<E>
- Type Parameters:
E
- The type of elements in this queue
- All Known Implementing Classes:
MyDLList
public interface QueueADT<E>
An interface representing the Queue Abstract Data Type.
-
Method Summary
Modifier and TypeMethodDescriptiondeQueue()
Removes the element in the first positionvoid
Adds an element to the first positionfront()
Returns the data in the first positionboolean
isEmpty()
Returnstrue
if this list contains no elements.int
size()
Returns the current element count in this queue.
-
Method Details
-
enQueue
Adds an element to the first position- Parameters:
element
- The element to be added- Throws:
NullPointerException
- If the element is null
-
deQueue
Removes the element in the first position- Returns:
- The head of this queue
- Throws:
NoSuchElementException
- If this queue is empty
-
front
Returns the data in the first position- Returns:
- The head of this queue
- Throws:
NoSuchElementException
- if this queue is empty
-
isEmpty
boolean isEmpty()Returnstrue
if this list contains no elements.- Returns:
true
if this list contains no elements.
-
size
int size()Returns the current element count in this queue.- Returns:
- The number of elements in this queue
-