All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface jdsl.simple.api.Deque

public interface Deque
Interface for a deque, or double-ended queue.

A deque is a collection of linearly arranged elements that are accessed, inserted, and removed at the beginning or at the end.

See Also:
DequeEmptyException, Queue, Stack

Method Index

 o first()
Gets the first element (without modifying the deque).
 o insertFirst(Object)
Insert an element at the beginning.
 o insertLast(Object)
Insert an element at the end.
 o isEmpty()
Tests if this deque is empty
 o last()
Gets the last element (without modifying the deque).
 o removeFirst()
Remove the element at the beginning.
 o removeLast()
Remove the element at the end.
 o size()
Gets the number of elements.

Methods

 o first
 public abstract Object first() throws DequeEmptyException
Gets the first element (without modifying the deque).

Returns:
first element in the deque.
Throws: DequeEmptyException
if the deque is empty
 o last
 public abstract Object last() throws DequeEmptyException
Gets the last element (without modifying the deque).

Returns:
last element in the deque.
Throws: DequeEmptyException
if the deque is empty
 o isEmpty
 public abstract boolean isEmpty()
Tests if this deque is empty

Returns:
true if the deque is empty, false otherwise.
 o size
 public abstract int size()
Gets the number of elements.

Returns:
number of elements in the deque.
 o insertFirst
 public abstract void insertFirst(Object element)
Insert an element at the beginning.

Parameters:
element - new element to be inserted.
 o insertLast
 public abstract void insertLast(Object element)
Insert an element at the end.

Parameters:
element - new element to be inserted.
 o removeFirst
 public abstract Object removeFirst() throws DequeEmptyException
Remove the element at the beginning.

Returns:
element removed.
Throws: DequeEmptyException
if the deque is empty
 o removeLast
 public abstract Object removeLast() throws DequeEmptyException
Remove the element at the end.

Returns:
element removed.
Throws: DequeEmptyException
if the deque is empty

All Packages  Class Hierarchy  This Package  Previous  Next  Index