org.mortbay.util
Class ArrayQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.mortbay.util.ArrayQueue<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, Queue<E>

public class ArrayQueue<E>
extends AbstractList<E>
implements Queue<E>

Queue backed by circular array. This partial Queue implementation (also with #pop() for stack operation) is backed by a growable circular array.

Author:
gregw

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ArrayQueue()
           
ArrayQueue(int capacity)
           
ArrayQueue(int initCapacity, int growBy)
           
 
Method Summary
 boolean add(E e)
           
 void clear()
           
 E element()
           
 E get(int index)
           
 boolean isEmpty()
           
 boolean offer(E e)
           
 E peek()
           
 E poll()
           
 E remove()
           
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
addAll, contains, containsAll, equals, hashCode, iterator, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ArrayQueue

public ArrayQueue()

ArrayQueue

public ArrayQueue(int capacity)

ArrayQueue

public ArrayQueue(int initCapacity,
                  int growBy)
Method Detail

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class AbstractList<E>

element

public E element()
Specified by:
element in interface Queue<E>

offer

public boolean offer(E e)
Specified by:
offer in interface Queue<E>

peek

public E peek()
Specified by:
peek in interface Queue<E>

poll

public E poll()
Specified by:
poll in interface Queue<E>

remove

public E remove()
Specified by:
remove in interface Queue<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface List<E>
Overrides:
clear in class AbstractList<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface List<E>
Overrides:
isEmpty in class AbstractCollection<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface List<E>
Specified by:
size in class AbstractCollection<E>

get

public E get(int index)
Specified by:
get in interface List<E>
Specified by:
get in class AbstractList<E>


Copyright © 2008 Mort Bay Consulting. All Rights Reserved.