Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.util.collection
Class ListQueue

    java.lang.Object
      java.util.AbstractCollection
          org.jboss.util.collection.AbstractQueue
              org.jboss.util.collection.ListQueue

All Implemented Interfaces:
  Collection, Queue

public class ListQueue
extends AbstractQueue

A ListQueue implements a first-in, first-out container using a List as a data structure.

Version:
  `$Revision: 1.3 $`
Author:
  Jason Dillon

Field Summary
`protected List` | `list` List container

Fields inherited from class org.jboss.util.collection.AbstractQueue
`DEFAULT_MAXIMUM_SIZE, maximumSize`

Fields inherited from interface org.jboss.util.collection.Queue
`UNLIMITED_MAXIMUM_SIZE`

Constructor Summary
`ListQueue()` Construct a new unconstrained ListQueue using a `LinkedList` for a data-structure.
`ListQueue(int maxSize)` Construct a new constrained ListQueue using a `LinkedList` for a data-structure.
`ListQueue(List list)` Construct a new unconstrained ListQueue.
`ListQueue(List list, int maxSize)` Construct a new constrained ListQueue.

Method Summary
`protected boolean` | `addLast(Object obj)` Appends the given element to the end of this list.
`Object` | `getBack()` Get the object at the back of the queue.
`Object` | `getFront()` Get the object at the front of the queue.
`Iterator` | `iterator()` Returns an iterator over the elements in this list in proper sequence.
`protected Object` | `removeFirst()` Remove the first object in the queue.
`Iterator` | `reverseIterator()` Returns an iterator over the elements in this list in reverse sequence.
`int` | `size()` Get the size of the queue.
`String` | `toString()` Return a String representation of this queue.

Methods inherited from class org.jboss.util.collection.AbstractQueue
`add, clear, getMaximumSize, isEmpty, isFull, remove, setMaximumSize`

Methods inherited from class java.util.AbstractCollection
`addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Collection
`addAll, contains, containsAll, equals, hashCode, remove, removeAll, retainAll, toArray, toArray`

Field Detail

### list

    protected final List list

  List container

Constructor Detail

### ListQueue

    public ListQueue(List list,
                     int maxSize)

  Construct a new constrained ListQueue.

Parameters:
  `list` - The list which will be used to store queued objects.
  `maxSize` - The maximum size of the queue.
Throws:
  `IllegalArgumentException` - List is null.

### ListQueue

    public ListQueue(int maxSize)

  Construct a new constrained ListQueue using a `LinkedList` for a data-structure.

Parameters:
  `maxSize` - The maximum size of the queue.

### ListQueue

    public ListQueue(List list)

  Construct a new unconstrained ListQueue.

Parameters:
  `list` - The list which will be used to store queued objects.
Throws:
  `IllegalArgumentException` - List is null

### ListQueue

    public ListQueue()

  Construct a new unconstrained ListQueue using a `LinkedList` for a data-structure.

Method Detail

### addLast

    protected boolean addLast(Object obj)

  Appends the given element to the end of this list.

  Specified by:
    `addLast` in class `AbstractQueue`
  Parameters:
    `obj` - Object to append.
  Returns:
    Per Collection.add(), we return a boolean to indicate if the object modified the collection.

### removeFirst

    protected Object removeFirst()

  Remove the first object in the queue.

  Specified by:
    `removeFirst` in class `AbstractQueue`
  Returns:
    First object in the queue.

### size

    public int size()

  Get the size of the queue.

  Returns:
    The number of elements in the queue.

### iterator

    public Iterator iterator()

  Returns an iterator over the elements in this list in proper sequence.

  Returns:
    An iterator over the elements in this list in proper sequence.

### getFront

    public Object getFront()
                    throws EmptyCollectionException

  Get the object at the front of the queue.

  Returns:
    Object at the front of the queue.
  Throws:
    `EmptyCollectionException` - The queue is empty.

### getBack

    public Object getBack()
                   throws EmptyCollectionException

  Get the object at the back of the queue.

  Returns:
    Object at the back of the queue.
  Throws:
    `EmptyCollectionException` - The queue is empty.

### reverseIterator

    public Iterator reverseIterator()

  Returns an iterator over the elements in this list in reverse sequence.

  Returns:
    An iterator over the elements in this list in reverse sequence.

### toString

    public String toString()

  Return a String representation of this queue.

  Returns:
    String

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.