corejava
Class LinkedList

java.lang.Object
  |
  +--corejava.LinkedList

public class LinkedList
extends java.lang.Object


Constructor Summary
LinkedList()
           
 
Method Summary
 void append(java.lang.Object n)
          insert after the tail of the list
 java.lang.Object currentElement()
           
 java.util.Enumeration elements()
           
 boolean hasMoreElements()
           
 void insert(java.lang.Object n)
          insert before the iterator position
static void main(java.lang.String[] args)
           
 java.lang.Object nextElement()
          move the cursor to the next position
 java.lang.Object remove()
          remove the element under the cursor
 void reset()
          resets the cursor
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedList

public LinkedList()
Method Detail

reset

public void reset()
resets the cursor

hasMoreElements

public boolean hasMoreElements()
Returns:
true iff the cursor is not at the end of the list

nextElement

public java.lang.Object nextElement()
move the cursor to the next position
Returns:
the current element (before advancing the position)
Throws:
java.util.NoSuchElementException - if already at the end of the list

currentElement

public java.lang.Object currentElement()
Returns:
the current element under the cursor
Throws:
java.util.NoSuchElementException - if already at the end of the list

insert

public void insert(java.lang.Object n)
insert before the iterator position
Parameters:
n - the object to insert

append

public void append(java.lang.Object n)
insert after the tail of the list
Parameters:
n - - the value to insert

remove

public java.lang.Object remove()
remove the element under the cursor
Returns:
the removed element
Throws:
java.util.NoSuchElementException - if already at the end of the list

size

public int size()
Returns:
the number of elements in the list

elements

public java.util.Enumeration elements()
Returns:
an enumeration to iterate through all elements in the list

main

public static void main(java.lang.String[] args)