Package java.util

Examples of java.util.EmptyStackException


    }

    public E pop() {
        Deque<E> st = deque.get();
        if (st == null) {
            throw new EmptyStackException();
        }
        E val = st.pop();
        if (st.isEmpty()) {
            deque.remove();
        }
View Full Code Here


    buffer[absTopOfStack(stackNum)] = value; 
  }

  static int pop(int stackNum) throws Exception {
    if (isEmpty(stackNum)) {
      throw new EmptyStackException();
    }
    int value = buffer[absTopOfStack(stackNum)]; // Get top
    buffer[absTopOfStack(stackNum)] = 0; // Clear index
    stackPointer[stackNum]--; // Decrement pointer
    return value;
View Full Code Here

    return value;
  }

  static int peek(int stackNum) {
    if (isEmpty(stackNum)) {
      throw new EmptyStackException();
    }   
    return buffer[absTopOfStack(stackNum)];
  }
View Full Code Here

   */
  public T peek()
  {
    if (size == 0)
    {
      throw new EmptyStackException();
    }
    return (T) contents[size - 1];
  }
View Full Code Here

   */
  public T pop()
  {
    if (size == 0)
    {
      throw new EmptyStackException();
    }
    size -= 1;
    final T retval = (T) contents[size];
    contents[size] = null;
    return retval;
View Full Code Here

         * Looks at the object at the top of this stack without removing it from the stack.
         * @return the object at the top of this stack
         */
        public Object peek() {
            if (size() == 0)
                throw new EmptyStackException();
            return get(size() - 1);
        }
View Full Code Here

         * Removes the object at the top of this stack and returns that object as the value of this function.
         * @return the object at the top of this stack
         */
        public Object pop() {
            if (size() == 0)
                throw new EmptyStackException();
            Object ret = get(size() - 1);
            remove(size() - 1);
            return ret;
        }
View Full Code Here

  public final Object peek()
  {
    int size = size();
    if (size == 0)
    {
      throw new EmptyStackException();
    }
    return get(size - 1);
  }
View Full Code Here

     */
    public V pop() throws EmptyStackException {
        if (this.size() > 0) {
            return backedList.removeFirst();
        }
        throw new EmptyStackException();
    }
View Full Code Here

     */
    public V peek() throws EmptyStackException {
        if (this.size() > 0) {
            return backedList.getFirst();
        }
        throw new EmptyStackException();
    }
View Full Code Here

TOP

Related Classes of java.util.EmptyStackException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.