package com.choongang;
import java.util.Stack;
import java.util.LinkedList;
public class StackStudy {
public static void main(String[] args){
//Stack<string> stack = new Stack<string>();
Stack stack = new Stack();
stack.push("1번");
stack.push("2번");
stack.push("3번");
System.out.println(stack.size());//stack 사이즈를 출력해라~
/*//System.out.println(stack.get(0));
System.out.println(stack.pop());
System.out.println(stack.isEmpty());
System.out.println(stack.pop());
System.out.println(stack.pop());
System.out.println(stack.isEmpty());*/
/* for 문으로
* int size = stack.size();
for(int i=0;i<size;i++){
System.out.println(stack.pop());
}*/
//while 문으로
while(!stack.isEmpty()){//stack이 비어 있지 않으면 실행 해라
System.out.println(stack.pop());
}
System.out.println("====================");
//LIFO : Last In First Out - Stack
//FIFO : First In First Out - Queue
LinkedList<string> link = new LinkedList<string>();
link.offer("사과");
link.offer("귤");
//link.poll();//Object를 return한다.
System.out.println(link.peek());
System.out.println(link.poll());
System.out.println(link.peek());
System.out.println(link.poll());
System.out.println(link.peek());
System.out.println(link.poll());
}
}