public SimpleNode <T> Peak() { if (_head == null) { return(null); } SimpleNode <T> temp = _head; while (temp.HasNext()) { temp = temp.GetNext(); } return(temp); }
public void Append(T value) { if (_head == null) { _head = new SimpleNode <T>(value); return; } SimpleNode <T> temp = _head; while (temp.HasNext()) { temp = temp.GetNext(); } temp.SetNext(new SimpleNode <T>(value)); }
public SimpleNode <T> Dequeue() { if (_head == null) { return(null); } SimpleNode <T> temp = _head; SimpleNode <T> prev = null; while (temp.HasNext()) { prev = temp; temp = temp.GetNext(); } if (prev == null) { Clear(); return(temp); } prev.SetNext(null); return(temp); }