Module org.hsqldb
Package org.hsqldb.lib

## Class HsqlDeque<E>

- java.lang.Object
- - org.hsqldb.lib.HsqlDeque<E>

- All Implemented Interfaces:
    `Collection<E>`, `List<E>`

      public class HsqlDeque<E>
      extends java.lang.Object
      implements List<E>

  A `List<E>` that also implements `Deque<E>` and `Queue<E>` and methods for usage as stack.

  When used as `Queue<E>`, elements are added to the end of the List (tail), and retrieved from the start of the List (head).

  When used as a stack, elements are added to and retrieved from the start of the List (head) using `push()` and `pop()` methods.

  Data is stored in an Object[] that doubles in size when the List gets full but does not shrink when it gets empty.

  Since:
    1.7.0
  Author:
    Fred Toussi (fredt@users dot sourceforge.net)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HsqlDeque()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(int i, E o)` |
    `boolean` | `add​(E o)` |
    `boolean` | `addAll​(E[] array)` |
    `boolean` | `addAll​(Collection<? extends E> other)` |
    `void` | `addFirst​(E o)` |
    `void` | `addLast​(E o)` |
    `void` | `clear()` |
    `boolean` | `contains​(java.lang.Object value)` |
    `Iterator<E>` | `descendingIterator()` |
    `E` | `element()` |
    `E` | `get​(int i)` |
    `E` | `getFirst()` |
    `E` | `getLast()` |
    `int` | `indexOf​(E value)` |
    `boolean` | `isEmpty()` |
    `Iterator<E>` | `iterator()` |
    `int` | `lastIndexOf​(E value)` |
    `boolean` | `offer​(E e)` |
    `boolean` | `offerFirst​(E e)` |
    `boolean` | `offerLast​(E e)` |
    `E` | `peek()` |
    `E` | `peekFirst()` |
    `E` | `peekLast()` |
    `E` | `poll()` |
    `E` | `pollFirst()` |
    `E` | `pollLast()` |
    `E` | `pop()` |
    `void` | `push​(E e)` |
    `E` | `remove()` |
    `E` | `remove​(int index)` |
    `boolean` | `remove​(E value)` |
    `E` | `removeFirst()` |
    `boolean` | `removeFirstOccurrence​(E o)` |
    `E` | `removeLast()` |
    `boolean` | `removeLastOccurrence​(E o)` |
    `E` | `set​(int i, E o)` |
    `int` | `size()` |
    `java.lang.Object[]` | `toArray()` |
    `<T> T[]` | `toArray​(T[] array)` |
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.hsqldb.lib.Collection

      `addAll`

    - ### Methods inherited from interface org.hsqldb.lib.List

      `isEmpty, iterator`

- - ### Constructor Detail

    - #### HsqlDeque

          public HsqlDeque()

  - ### Method Detail

    - #### size

          public int size()

      Specified by:
        `size` in interface `Collection<E>`
      Specified by:
        `size` in interface `List<E>`

    - #### offer

          public boolean offer​(E e)

    - #### remove

          public E remove()

    - #### poll

          public E poll()

    - #### element

          public E element()

    - #### peek

          public E peek()

    - #### push

          public void push​(E e)

    - #### pop

          public E pop()

    - #### getFirst

          public E getFirst()
                     throws java.util.NoSuchElementException

      Throws:
        `java.util.NoSuchElementException`

    - #### getLast

          public E getLast()
                    throws java.util.NoSuchElementException

      Throws:
        `java.util.NoSuchElementException`

    - #### get

          public E get​(int i)
                throws java.lang.IndexOutOfBoundsException

      Specified by:
        `get` in interface `List<E>`
      Throws:
        `java.lang.IndexOutOfBoundsException`

    - #### add

          public void add​(int i,
                          E o)
                   throws java.lang.IndexOutOfBoundsException

      Specified by:
        `add` in interface `List<E>`
      Throws:
        `java.lang.IndexOutOfBoundsException`

    - #### set

          public E set​(int i,
                       E o)
                throws java.lang.IndexOutOfBoundsException

      Specified by:
        `set` in interface `List<E>`
      Throws:
        `java.lang.IndexOutOfBoundsException`

    - #### removeFirst

          public E removeFirst()
                        throws java.util.NoSuchElementException

      Throws:
        `java.util.NoSuchElementException`

    - #### removeLast

          public E removeLast()
                       throws java.util.NoSuchElementException

      Throws:
        `java.util.NoSuchElementException`

    - #### peekFirst

          public E peekFirst()

    - #### peekLast

          public E peekLast()

    - #### offerFirst

          public boolean offerFirst​(E e)

    - #### offerLast

          public boolean offerLast​(E e)

    - #### pollFirst

          public E pollFirst()

    - #### pollLast

          public E pollLast()

    - #### removeFirstOccurrence

          public boolean removeFirstOccurrence​(E o)

    - #### removeLastOccurrence

          public boolean removeLastOccurrence​(E o)

    - #### descendingIterator

          public Iterator<E> descendingIterator()

    - #### add

          public boolean add​(E o)

      Specified by:
        `add` in interface `Collection<E>`
      Specified by:
        `add` in interface `List<E>`

    - #### addLast

          public void addLast​(E o)

    - #### addFirst

          public void addFirst​(E o)

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Collection<E>`

    - #### indexOf

          public int indexOf​(E value)

    - #### contains

          public boolean contains​(java.lang.Object value)

      Specified by:
        `contains` in interface `Collection<E>`

    - #### remove

          public boolean remove​(E value)

      Specified by:
        `remove` in interface `Collection<E>`

    - #### lastIndexOf

          public int lastIndexOf​(E value)

    - #### remove

          public E remove​(int index)

      Specified by:
        `remove` in interface `List<E>`

    - #### toArray

          public <T> T[] toArray​(T[] array)

    - #### toArray

          public java.lang.Object[] toArray()

    - #### addAll

          public boolean addAll​(Collection<? extends E> other)

    - #### addAll

          public boolean addAll​(E[] array)

    - #### isEmpty

          public boolean isEmpty()

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### iterator

          public Iterator<E> iterator()