Module org.hsqldb

Class 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 Detail

      • HsqlDeque

        public HsqlDeque()
    • Method Detail

      • 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)
      • 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()