///Sets next element from the Last Last, returns element of the former Last. public int Pop() { if (Last == null) { return 0; } int result = Last.GetValue(); Last = Last.GetNext(); return result; }
/// Deletes last element, returns its value. If stack is empty, throws exeption. public int Pop() { if (head == null) { throw new StackNullExeption("Trying to pop an empty stack."); } int result = head.GetValue(); head = head.GetNext(); return result; }
///Sets next element from the Last Last, returns element of the former Last. public int Pop() { if (Last == null) { return(0); } int result = Last.GetValue(); Last = Last.GetNext(); return(result); }
/// Deletes last element, returns its value. If stack is empty, throws exeption. public int Pop() { if (head == null) { throw new StackNullExeption("Trying to pop an empty stack."); } int result = head.GetValue(); head = head.GetNext(); return(result); }
public ReferenceStackElement(int value = 0, ReferenceStackElement next = null) { this.value = value; this.next = next; }
///Creates new element with a reference to current last and sets it last. public void Push(int value) { Last = new ReferenceStackElement(value, Last); }
/// Gets int value and sets element with current value as head. public void Push(int value) { head = new ReferenceStackElement(value, head); }