Stack

stack继承Vetor

  • add

    public boolean add(E e)

    Appends the specified element to the end of this Vector.

  • push

    public E push(E item)
    Pushes an item onto the top of this stack. This has exactly the same effect as:
     addElement(item)

push和add都可以向stack中添加元素,不同的是push是stach本身方法,add是继承于vetor的

  • pop

    public E pop()

    Removes the object at the top of this stack and returns that object as the value of this function.移除栈顶元素并返回

  • peek

    public E peek()

    Looks at the object at the top of this stack without removing it from the stack.返回栈顶元素但不删除

java队列——queue详细分析

 

java 集合框架(十五)Deque

 

 

 

你可能感兴趣的:(Java)