FileDocCategorySizeDatePackage
LLEnumeration.javaAPI DocGlassfish v2 API1468Wed Aug 30 15:34:16 BST 2006persistence.antlr.collections.impl

LLEnumeration

public final class LLEnumeration extends Object implements Enumeration
An enumeration of a LList. Maintains a cursor through the list. bad things would happen if the list changed via another thread while we were walking this list.

Fields Summary
LLCell
cursor
LList
list
Constructors Summary
public LLEnumeration(LList l)
Create an enumeration attached to a LList

        list = l;
        cursor = list.head;
    
Methods Summary
public booleanhasMoreElements()
Return true/false depending on whether there are more elements to enumerate.

        if (cursor != null)
            return true;
        else
            return false;
    
public java.lang.ObjectnextElement()
Get the next element in the enumeration. Destructive in that the returned element is removed from the enumeration. This does not affect the list itself.

return
the next object in the enumeration.

        if (!hasMoreElements()) throw new NoSuchElementException();
        LLCell p = cursor;
        cursor = cursor.next;
        return p.data;