dataStructures
Class ArrayQueue
java.lang.Object
|
+--dataStructures.ArrayQueue
- public class ArrayQueue
- extends java.lang.Object
- implements Queue
Constructor Summary |
ArrayQueue()
create a queue with initial capacity 10 |
ArrayQueue(int initialCapacity)
create a queue with the given initial capacity |
Method Summary |
java.lang.Object |
getFrontElement()
|
java.lang.Object |
getRearElement()
|
boolean |
isEmpty()
|
static void |
main(java.lang.String[] args)
test program |
void |
put(java.lang.Object theElement)
insert theElement at the rear of the queue |
java.lang.Object |
remove()
remove an element from the front of the queue |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ArrayQueue
public ArrayQueue(int initialCapacity)
- create a queue with the given initial capacity
ArrayQueue
public ArrayQueue()
- create a queue with initial capacity 10
isEmpty
public boolean isEmpty()
- Specified by:
- isEmpty in interface Queue
- Returns:
- true iff queue is empty
getFrontElement
public java.lang.Object getFrontElement()
- Specified by:
- getFrontElement in interface Queue
- Returns:
- front element of queue
getRearElement
public java.lang.Object getRearElement()
- Specified by:
- getRearElement in interface Queue
- Returns:
- rear element of queue
put
public void put(java.lang.Object theElement)
- insert theElement at the rear of the queue
- Specified by:
- put in interface Queue
remove
public java.lang.Object remove()
- remove an element from the front of the queue
- Specified by:
- remove in interface Queue
- Returns:
- removed element
main
public static void main(java.lang.String[] args)
- test program