xxl.collections
Class ListQueue

java.lang.Object
  |
  +--xxl.collections.AbstractQueue
        |
        +--xxl.collections.ListQueue

public class ListQueue
extends AbstractQueue

The ArrayQueue extends AbstractQueue using a List for the internal representation of the data.


Field Summary
static Function FACTORY_METHOD
          A factory method to create a new ListQueue.
protected  java.util.List list
          The List used for the internal representation of the data.
 
Fields inherited from class xxl.collections.AbstractQueue
FACTORY_METHOD
 
Constructor Summary
ListQueue()
          Creates a new ListQueue by creating a LinkedList.
ListQueue(java.util.Iterator iterator)
          Creates a new ListQueue by creating a LinkedList.
ListQueue(java.util.List list)
          Creates a new ListQueue.
ListQueue(java.util.List list, java.util.Iterator iterator)
          Creates a new ListQueue.
 
Method Summary
 void insert(java.lang.Object object)
          Appends an object to the end of the queue.
 java.lang.Object next()
          Returns the next element in the iteration.
 java.lang.Object peek()
          Shows the next element in the iteration without removing it.
 int size()
          Returns the size of the Queue.
 boolean supportsPeek()
          Returns true if the peek operation is supported by this PeekIterator.
 
Methods inherited from class xxl.collections.AbstractQueue
clear, close, hasNext, insertAll, remove, replace, replaceAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTORY_METHOD

public static final Function FACTORY_METHOD
A factory method to create a new ListQueue. It may be invoked with or without a given array. (see contract for FACTORY_METHOD in interface Queue)

list

protected java.util.List list
The List used for the internal representation of the data.
Constructor Detail

ListQueue

public ListQueue(java.util.List list)
Creates a new ListQueue.
Parameters:
list - the List to be used for the internal representation of data

ListQueue

public ListQueue()
Creates a new ListQueue by creating a LinkedList.

ListQueue

public ListQueue(java.util.List list,
                 java.util.Iterator iterator)
Creates a new ListQueue.
Parameters:
list - the List to be used for the internal representation of data
iterator - elements to be inserted into the queue

ListQueue

public ListQueue(java.util.Iterator iterator)
Creates a new ListQueue by creating a LinkedList.
Parameters:
iterator - elements to be inserted into the queue
Method Detail

insert

public void insert(java.lang.Object object)
Appends an object to the end of the queue.
Parameters:
object - object to be appended to the queue
Overrides:
insert in class AbstractQueue

peek

public java.lang.Object peek()
                      throws java.util.NoSuchElementException
Shows the next element in the iteration without removing it.
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - iteration has no more elements
java.lang.UnsupportedOperationException - if the peek operation is not supported by this PeekIterator
Overrides:
peek in class AbstractQueue

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Returns the next element in the iteration.
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - iteration has no more elements
Overrides:
next in class AbstractQueue

size

public int size()
Returns the size of the Queue.
Overrides:
size in class AbstractQueue

supportsPeek

public boolean supportsPeek()
Returns true if the peek operation is supported by this PeekIterator.
Returns:
true if the peek operation is supported by this PeekIterator
Overrides:
supportsPeek in class AbstractQueue