public void AddFirst(E element) { SNode <E> newest = new SNode <E>(element, head); head = newest; if (IsEmpty()) { tail = newest; } size++; }
public E RemoveFirst() { SNode <E> temp = head; head = temp.Next; temp.Next = null; E tempElement = temp.Element; temp.Element = default; size--; return(tempElement); }
public void AddLast(E element) { SNode <E> newest = new SNode <E>(element, null); if (IsEmpty()) { head = newest; } else { tail.Next = newest; } tail = newest; size++; }
public SNode(E element, SNode <E> next) { Element = element; Next = next; }
public SList() { head = null; tail = null; }