- 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>
AList<E>
that also implementsDeque<E>
andQueue<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()
andpop()
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
-
-
-
-
Method Detail
-
size
public int size()
-
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
-
add
public void add(int i, E o) 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)
-
add
public boolean add(E o)
-
addLast
public void addLast(E o)
-
addFirst
public void addFirst(E o)
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
-
indexOf
public int indexOf(E value)
-
contains
public boolean contains(java.lang.Object value)
- Specified by:
contains
in interfaceCollection<E>
-
remove
public boolean remove(E value)
- Specified by:
remove
in interfaceCollection<E>
-
lastIndexOf
public int lastIndexOf(E value)
-
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 classjava.lang.Object
-
iterator
public Iterator<E> iterator()
-
-