public List() { head = new ListElement(); head.num = 0; head.next = null; length = 0; }
public void Insert(int value, ListElement pos) { ListElement temp = new ListElement(); temp.num = value; temp.next = pos.next; pos.next = temp; ++length; }
public void Remove(ListElement pos) { ListElement temp = this.head; if (this.head.next == null) return; while (temp.next == null || temp.next != pos) { temp = temp.next; } temp.next = pos.next; --length; }
public int Retrieve(ListElement pos) { return pos.num; }
public ListElement Next(ListElement pos) { return pos.next; }