public void InsertAfter(T theElement) { CNode <T> newNode = new CNode <T>(theElement); newNode.Link = current.Link; current.Link = newNode; }
public void ShowList() { CNode <T> current = header.Link; while (!(current == null)) { Console.WriteLine(current.Element); current = current.Link; } }
public void InsertBefore(T theElement) { CNode <T> newNode = new CNode <T>(theElement); if (previous.Link == null) { throw new InsertBeforeHeaderException("Can't insert here."); } else { newNode.Link = previous.Link; previous.Link = newNode; current = newNode; } }
public void Reset() { current = theList.GetFirst(); previous = null; }
public void NextLink() { previous = current; current = current.Link; }
public ListIter(CLinkedList <T> list) { theList = list; current = theList.GetFirst(); previous = null; }
public CLinkedList() { header = new CNode <T>(default(T)); }
public CNode(T theElement) { Element = theElement; Link = null; }
public CNode() { Element = default(T); Link = null; }