BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Interface List

All Superinterfaces:
Collection
All Known Implementing Classes:
ArrayList, LinkedList

public interface List
extends Collection

An interface for methods common to any sequence of elements. Organizes objects in a linear fashion. Maintains the order of insertion inside the data structure.


Method Summary
 void append(java.lang.Object o)
          Appends given element to the end of the list.
 void clear()
          Removes all elements from the list.
 java.lang.Object getFirst()
          Returns the element at the beginning of the list.
 java.lang.Object getLast()
          Returns the element at the end of the list.
 boolean isEmpty()
          Returns true if there are no elements in the list size == 0.
 ListIterator iterator()
          Returns an ListIterator.
 void prepend(java.lang.Object elt)
          Prepends given element to the beginning of the list.
 java.lang.Object removeFirst()
          Removes and returns the first element in the list.
 java.lang.Object removeLast()
          Removes last element in the list (optional operation).
 ReverseListIterator reverseIterator()
          Creates a ReverseListIterator (optional operation).]
 int size()
          Returns the size of the List.
 

Method Detail

prepend

public void prepend(java.lang.Object elt)
Prepends given element to the beginning of the list.
Parameters:
elt - the element to be prepended.

append

public void append(java.lang.Object o)
Appends given element to the end of the list.
Parameters:
elt - the element to be appended.

getFirst

public java.lang.Object getFirst()
Returns the element at the beginning of the list.
Returns:
the element at the beginning of the list.
Throws:
NoSuchElementException - if the list is empty.

getLast

public java.lang.Object getLast()
Returns the element at the end of the list.
Returns:
the element at the end of the list.
Throws:
NoSuchElementException - if the list is empty.

removeFirst

public java.lang.Object removeFirst()
Removes and returns the first element in the list.
Returns:
first element.
Throws:
NoSuchElementException - if the list is empty.

removeLast

public java.lang.Object removeLast()
                            throws java.lang.UnsupportedOperationException
Removes last element in the list (optional operation).
Throws:
java.lang.UnsupportedOperationException -  

size

public int size()
Returns the size of the List.
Specified by:
size in interface Collection
Returns:
the size of the list.

isEmpty

public boolean isEmpty()
Returns true if there are no elements in the list size == 0.
Specified by:
isEmpty in interface Collection
Returns:
true if there are no elements in the list size == 0.

clear

public void clear()
Removes all elements from the list.
Specified by:
clear in interface Collection

iterator

public ListIterator iterator()
Returns an ListIterator.

reverseIterator

public ReverseListIterator reverseIterator()
                                    throws java.lang.UnsupportedOperationException
Creates a ReverseListIterator (optional operation).]
Throws:
UnsupportedMethodException -  


BRUtil - Making Java a Kinder, Gentler, Place to be.