Interface SimpleQueue<AnyType>

All Superinterfaces:
java.lang.Iterable<AnyType>
All Known Implementing Classes:
MyList

public interface SimpleQueue<AnyType>
extends java.lang.Iterable<AnyType>

An interface for queues that includes an Iterator. All of these operations should run in O(1) time. Make !NO! changes to this file!


Method Summary
 AnyType dequeue()
          Retrieves and removes the first element of the queue
 void enqueue(AnyType value)
          Inserts an element at the end of the queue
 boolean isEmpty()
          Determines if the queue has no elements
 AnyType peek()
          Retrieves, but does not remove, the first element of the queue
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

isEmpty

boolean isEmpty()
Determines if the queue has no elements

Returns:
true if the queue is empty; false otherwise

enqueue

void enqueue(AnyType value)
Inserts an element at the end of the queue

Parameters:
value - the element to be inserted into the queue

dequeue

AnyType dequeue()
Retrieves and removes the first element of the queue

Returns:
the element at the front of the original queue, or null if the queue is empty

peek

AnyType peek()
Retrieves, but does not remove, the first element of the queue

Returns:
the element at the front of the original queue, or null if the queue is empty