DoubleLink
Class DeleteList
java.lang.Object
|
+--DoubleLink.DeleteList
- public class DeleteList
- extends java.lang.Object
DeleteList models a list that allows deletion of arbitrary elements:
-- the insertion method adds a new object to the list, and returns
a ``key'' to that object;
-- the deletion method uses the ``key'' to locate and delete the object;
-- the list's contents can be printed from front to rear
Constructor Summary |
DeleteList()
Constructor DeleteList constructs an empty list |
Method Summary |
void |
delete(java.lang.Object key)
delete removes the object from the list that is identified by the
``key'' parameter |
java.lang.Object |
insert(java.lang.Object ob)
insert adds a new object to the list |
java.lang.String |
toString()
toString constructs a string representation of the list's contents |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
DeleteList
public DeleteList()
- Constructor DeleteList constructs an empty list
insert
public java.lang.Object insert(java.lang.Object ob)
- insert adds a new object to the list
- Parameters:
ob
- - the object added- Returns:
- an address which will be used as the ``key'' to the object
delete
public void delete(java.lang.Object key)
- delete removes the object from the list that is identified by the
``key'' parameter
- Parameters:
key
- - the ``key'' to the object to be removed
toString
public java.lang.String toString()
- toString constructs a string representation of the list's contents
- Returns:
- the string
- Overrides:
- toString in class java.lang.Object