///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;
 }
Exemple #3
0
        ///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);
        }
Exemple #4
0
        /// 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);
 }
Exemple #7
0
 ///Creates new element with a reference to current last and sets it last.
 public void Push(int value)
 {
     Last = new ReferenceStackElement(value, Last);
 }
Exemple #8
0
 public ReferenceStackElement(int value = 0, ReferenceStackElement next = null)
 {
     this.value = value;
     this.next  = next;
 }
 /// Gets int value and sets element with current value as head.
 public void Push(int value)
 {
     head = new ReferenceStackElement(value, head);
 }
Exemple #10
0
 /// Gets int value and sets element with current value as head.
 public void Push(int value)
 {
     head = new ReferenceStackElement(value, head);
 }