Ableverse™
Platform 6.0

av.util
Class ArrayQueue<T>

java.lang.Object
  extended by av.util.ArrayQueue<T>
All Implemented Interfaces:
Queue<T>

public class ArrayQueue<T>
extends Object
implements Queue<T>

This is an array based Queue implementation.

This class is synchronized by a ReentrantReadWriteLock.

Author:
compl

Constructor Summary
ArrayQueue()
           
ArrayQueue(int initCapacity)
           
 
Method Summary
 void clear()
          clear all
 T dequeue()
          remove the first element from the queue and return it.
<V extends T>
void
enqueue(V o)
          add o to the end of the queue.
 void enqueueAll(Collection<? extends T> collection)
          add all objects in collection to end of the queue.
 void ensureCapacity(int minCapacity)
           
 boolean isEmpty()
          test whether this queue is empty.
 T peek()
          return the first element in the queue but don't remove it from the queue.
<V extends T>
void
precede(V o)
          add o to the beginning of the queue.
 int size()
          return size of the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayQueue

public ArrayQueue(int initCapacity)

ArrayQueue

public ArrayQueue()
Method Detail

enqueue

public <V extends T> void enqueue(V o)
Description copied from interface: Queue
add o to the end of the queue.

Specified by:
enqueue in interface Queue<T>

enqueueAll

public void enqueueAll(Collection<? extends T> collection)
Description copied from interface: Queue
add all objects in collection to end of the queue.

Specified by:
enqueueAll in interface Queue<T>

precede

public <V extends T> void precede(V o)
Description copied from interface: Queue
add o to the beginning of the queue.

Specified by:
precede in interface Queue<T>

ensureCapacity

public void ensureCapacity(int minCapacity)

peek

public T peek()
Description copied from interface: Queue
return the first element in the queue but don't remove it from the queue.

Specified by:
peek in interface Queue<T>
Returns:
the first element in this queue

dequeue

public T dequeue()
Description copied from interface: Queue
remove the first element from the queue and return it.

Specified by:
dequeue in interface Queue<T>
Returns:
the first element removed from the queue

isEmpty

public boolean isEmpty()
Description copied from interface: Queue
test whether this queue is empty.

Specified by:
isEmpty in interface Queue<T>
Returns:
if this queue is empty

size

public int size()
Description copied from interface: Queue
return size of the queue.

Specified by:
size in interface Queue<T>
Returns:
size of this queue

clear

public void clear()
Description copied from interface: Queue
clear all

Specified by:
clear in interface Queue<T>

Ableverse™
Platform 6.0

Copyright© 2006 Ableverse Platform. All rights reserved.