|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.stepsoncats.gublists.Lklist
A Lklist is a simple doubly-linked list. Linked list libraries typically enable you to insert some item of data into a list; the list methods automatically wrap the data item in a list element and return the element to you. Lklist is instead built on a model of creating a list element of a particular type (a subclass of the LklistElt base class) to contain a data item and then inserting that list element into some list; the contents of the linked list can be completely heterogeneous. The Lklist class provides the methods for populating, using, and depopulating the list. The LklistElt base class provides no methods other than the constructor.
Constructor Summary | |
Lklist()
Construct an empty linked list. |
Method Summary | |
void |
append(LklistElt elt)
Insert the specified element at the back of the list, that is, following the last element in the list. |
int |
countOfElements()
Return the number of elements in the list. |
LklistElt |
elementAfter(LklistElt elt)
Return the list element that immediately follows the specified element. |
LklistElt |
elementBefore(LklistElt elt)
Return the list element that immediately precedes the specified element. |
void |
extract(LklistElt elt)
Remove the specified element from the list. |
LklistElt |
extractFirst()
Remove the first element from the list. |
LklistElt |
firstElement()
Return the first element of the list. |
void |
insertAfter(LklistElt oldElt,
LklistElt newElt)
Insert the specified new list element after the specified existing list element. |
void |
insertBefore(LklistElt oldElt,
LklistElt newElt)
Insert the specified new list element before the specified existing list element. |
LklistElt |
lastElement()
Return the last element of the list. |
void |
prepend(LklistElt elt)
Insert the specified element at the front of the list, that is, preceding the first element in the list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Lklist()
Method Detail |
public LklistElt firstElement()
public LklistElt lastElement()
public int countOfElements()
public LklistElt elementBefore(LklistElt elt)
elt
- The list element that immediately follows the one you want.public LklistElt elementAfter(LklistElt elt)
elt
- The list element that immediately precedes the one you want.public void prepend(LklistElt elt)
elt
- The list element to insert into the list.public void append(LklistElt elt)
elt
- The list element to insert into the list.public void insertBefore(LklistElt oldElt, LklistElt newElt)
oldElt
- The list element that should immediately follow the new list
element, after the new element has been inserted into the list.newElt
- The new list element to insert into the list.public void insertAfter(LklistElt oldElt, LklistElt newElt)
oldElt
- The list element that should immediately precede the new list
element, after the new element has been inserted into the list.newElt
- The new list element to insert into the list.public void extract(LklistElt elt)
elt
- The list element to remove from the list.public LklistElt extractFirst()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |