org.apache.mina.util
Class CircularQueue<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by org.apache.mina.util.CircularQueue<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.Queue<E>

public class CircularQueue<E>
extends java.util.AbstractList<E>
implements java.util.Queue<E>, java.io.Serializable

A unbounded circular queue based on array.

Author:
Apache MINA Project
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CircularQueue()
          Construct a new, empty queue.
CircularQueue(int initialCapacity)
           
 
Method Summary
 boolean add(E o)
           
 void add(int idx, E o)
           
 int capacity()
          Returns the capacity of this queue.
 void clear()
           
 E element()
           
 E get(int idx)
           
 boolean isEmpty()
           
 boolean offer(E item)
           
 E peek()
           
 E poll()
           
 E remove()
           
 E remove(int idx)
           
 E set(int idx, E o)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
 
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

CircularQueue

public CircularQueue()
Construct a new, empty queue.


CircularQueue

public CircularQueue(int initialCapacity)
Method Detail

capacity

public int capacity()
Returns the capacity of this queue.


clear

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

poll

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

offer

public boolean offer(E item)
Specified by:
offer in interface java.util.Queue<E>

peek

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

get

public E get(int idx)
Specified by:
get in interface java.util.List<E>
Specified by:
get in class java.util.AbstractList<E>

isEmpty

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

size

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

toString

public java.lang.String toString()
Overrides:
toString in class java.util.AbstractCollection<E>

add

public boolean add(E o)
Specified by:
add in interface java.util.Collection<E>
Specified by:
add in interface java.util.List<E>
Specified by:
add in interface java.util.Queue<E>
Overrides:
add in class java.util.AbstractList<E>

set

public E set(int idx,
             E o)
Specified by:
set in interface java.util.List<E>
Overrides:
set in class java.util.AbstractList<E>

add

public void add(int idx,
                E o)
Specified by:
add in interface java.util.List<E>
Overrides:
add in class java.util.AbstractList<E>

remove

public E remove(int idx)
Specified by:
remove in interface java.util.List<E>
Overrides:
remove in class java.util.AbstractList<E>

remove

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

element

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


Copyright © 2004-2011 Apache MINA Project. All Rights Reserved.