All Packages Class Hierarchy This Package Previous Next Index
Interface list.Position
- public interface Position
An interface for "Positions" within a list class, which might
be used by singly-linked, doubly-linked, acycle, or cyclic
lists, for example. A Position is similar to an "index" in
an array or vector, in that you may get and set elements at
a given position and get new Positions relative to the current one.
-
elementAt()
- Returns the element at the current position.
-
insertAfter(Object)
- Inserts elem just before the current position in the list.
-
insertBefore(Object)
- Inserts elem just before the current position in the list.
-
isValidPosition()
- Determines whether the current position is valid.
-
next()
- Constructs a new ListPosition at the position after this one.
-
previous()
- Constructs a new ListPosition at the position before this one.
-
remove()
- Removes the element at this position in the DList.
-
setElementAt(Object)
- Sets the element at the current position to elem.
next
public abstract Position next() throws ListBoundsException
- Constructs a new ListPosition at the position after this one.
This position is not modified.
- Throws: ListBoundsException
- if the current position is not valid.
previous
public abstract Position previous() throws ListBoundsException
- Constructs a new ListPosition at the position before this one.
This position is not modified.
- Throws: ListBoundsException
- if the current position is not valid.
elementAt
public abstract Object elementAt() throws ListBoundsException
- Returns the element at the current position.
- Throws: ListBoundsException
- if the current position is not valid.
setElementAt
public abstract void setElementAt(Object elem) throws ListBoundsException
- Sets the element at the current position to elem.
- Throws: ListBoundsException
- if the current position is not valid.
insertBefore
public abstract void insertBefore(Object elem) throws ListBoundsException
- Inserts elem just before the current position in the list.
- Throws: ListBoundsException
- if the current position is not valid.
insertAfter
public abstract void insertAfter(Object elem) throws ListBoundsException
- Inserts elem just before the current position in the list.
- Throws: ListBoundsException
- if the current position is not valid.
remove
public abstract Object remove() throws ListBoundsException
- Removes the element at this position in the DList.
- Returns:
- the element at the current position (before removal).
- Throws: ListBoundsException
- if the current position is not valid.
isValidPosition
public abstract boolean isValidPosition()
- Determines whether the current position is valid.
- Returns:
- true if the current position is valid, false otherwise
All Packages Class Hierarchy This Package Previous Next Index