## org.eclipse.jetty.util
Class ArrayQueue<E>

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractList<E>
              org.eclipse.jetty.util.ArrayQueue<E>

Type Parameters:
  `E` -

All Implemented Interfaces:
  java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.Queue<E>

    public class ArrayQueue<E>

extends java.util.AbstractList<E>
implements java.util.Queue<E>

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

Field Summary
`protected java.lang.Object[]` `_elements`
`protected int` `_growCapacity`
`protected java.lang.Object` `_lock`
`protected int` `_nextE`
`protected int` `_nextSlot`
`protected int` `_size`
`int` `DEFAULT_CAPACITY`
`int` `DEFAULT_GROWTH`

Fields inherited from class java.util.AbstractList
`modCount`

Constructor Summary
`ArrayQueue()`
`ArrayQueue(int capacity)`
`ArrayQueue(int initCapacity, int growBy)`
`ArrayQueue(int initCapacity, int growBy, java.lang.Object lock)`

Method Summary
`boolean` `add(E e)`
`void` `add(int index, E element)`
`void` `addUnsafe(E e)` Add without synchronization or bounds checking
`void` `clear()`
`E` `element()`
`E` `get(int index)`
`int` `getCapacity()`
`E` `getUnsafe(int index)` Get without synchronization or bounds checking.
`protected boolean` `grow()`
`boolean` `isEmpty()`
`boolean` `offer(E e)`
`E` `peek()`
`E` `poll()`
`E` `remove()`
`E` `remove(int index)`
`E` `set(int index, E element)`
`int` `size()`

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, 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`

Field Detail

### DEFAULT_CAPACITY

    public final int DEFAULT_CAPACITY

See Also:
  Constant Field Values

### DEFAULT_GROWTH

    public final int DEFAULT_GROWTH

See Also:
  Constant Field Values

### _lock

    protected java.lang.Object _lock

### _elements

    protected java.lang.Object[] _elements

### _nextE

    protected int _nextE

### _nextSlot

    protected int _nextSlot

### _size

    protected volatile int _size

### _growCapacity

    protected int _growCapacity

Constructor Detail

### ArrayQueue

    public ArrayQueue()

### ArrayQueue

    public ArrayQueue(int capacity)

### ArrayQueue

    public ArrayQueue(int initCapacity,
                      int growBy)

### ArrayQueue

    public ArrayQueue(int initCapacity,
                      int growBy,
                      java.lang.Object lock)

Method Detail

### getCapacity

    public int getCapacity()

### add

    public boolean add(E e)

  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>`

### offer

    public boolean offer(E e)

  Specified by:
    `offer` in interface `java.util.Queue<E>`

### addUnsafe

    public void addUnsafe(E e)

  Add without synchronization or bounds checking

  See Also:
    `add(Object)`

### element

    public E element()

  Specified by:
    `element` in interface `java.util.Queue<E>`

### peek

    public E peek()

  Specified by:
    `peek` in interface `java.util.Queue<E>`

### poll

    public E poll()

  Specified by:
    `poll` in interface `java.util.Queue<E>`

### remove

    public E remove()

  Specified by:
    `remove` in interface `java.util.Queue<E>`

### 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>`

### 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>`

### get

    public E get(int index)

  Specified by:
    `get` in interface `java.util.List<E>`
  Specified by:
    `get` in class `java.util.AbstractList<E>`

### getUnsafe

    public E getUnsafe(int index)

  Get without synchronization or bounds checking.

  See Also:
    `get(int)`

### remove

    public E remove(int index)

  Specified by:
    `remove` in interface `java.util.List<E>`
  Overrides:
    `remove` in class `java.util.AbstractList<E>`

### set

    public E set(int index,
                 E element)

  Specified by:
    `set` in interface `java.util.List<E>`
  Overrides:
    `set` in class `java.util.AbstractList<E>`

### add

    public void add(int index,
                    E element)

  Specified by:
    `add` in interface `java.util.List<E>`
  Overrides:
    `add` in class `java.util.AbstractList<E>`

### grow

    protected boolean grow()

Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.