类 StandardStack<T>

  • 类型参数:
    T - The type of things stored in the stack
    所有已实现的接口:
    Stack<T>

    public class StandardStack<T>
    extends Object
    implements Stack<T>
    A general-purpose stack impl.
    作者:
    Steve Ebersole
    • 构造器详细资料

      • StandardStack

        public StandardStack()
      • StandardStack

        public StandardStack​(T initial)
    • 方法详细资料

      • push

        public void push​(T newCurrent)
        从接口复制的说明: Stack
        Push the new element on the top of the stack
        指定者:
        push 在接口中 Stack<T>
      • pop

        public T pop()
        从接口复制的说明: Stack
        Pop (remove and return) the current element off the stack
        指定者:
        pop 在接口中 Stack<T>
      • getCurrent

        public T getCurrent()
        从接口复制的说明: Stack
        The element currently at the top of the stack
        指定者:
        getCurrent 在接口中 Stack<T>
      • getPrevious

        public T getPrevious()
        从接口复制的说明: Stack
        The element previously at the top of the stack before the current one
        指定者:
        getPrevious 在接口中 Stack<T>
      • depth

        public int depth()
        从接口复制的说明: Stack
        How many elements are currently on the stack?
        指定者:
        depth 在接口中 Stack<T>
      • isEmpty

        public boolean isEmpty()
        从接口复制的说明: Stack
        Are there no elements currently in the stack?
        指定者:
        isEmpty 在接口中 Stack<T>
      • clear

        public void clear()
        从接口复制的说明: Stack
        Remove all elements from the stack
        指定者:
        clear 在接口中 Stack<T>
      • visitCurrentFirst

        public void visitCurrentFirst​(Consumer<T> action)
        从接口复制的说明: Stack
        Visit all elements in the stack, starting with the current and working back
        指定者:
        visitCurrentFirst 在接口中 Stack<T>
      • findCurrentFirst

        public <X> X findCurrentFirst​(Function<T,​X> function)
        从接口复制的说明: Stack
        Find an element on the stack and return a value. The first non-null element returned from `action` stops the iteration and is returned from here
        指定者:
        findCurrentFirst 在接口中 Stack<T>