new Stack
new HashMap<[type]>()
Stack<Integer> stack = new Stack<>();
- push
push(E element)
stack.push(1);
stack.push(2);
stack.push(3);
stack.push(4);
pop
clear
pop()
stack.pop();
clear()
stack.clear();
peek
peek()
System.out.println(stack.peek());
출력
3
- size
- empty
- search
size()
int size = stack.size();
empty()
//stack에 데이터 있으면 반복
while(!stack.empty()){
...
}
search(D data)
System.out.println(stack.search(1));