package DataStructure_Test;
import java.util.*;
class ArrayListTest {
public static void main(String[] args) {
// ArrayList
ArrayList<integer> var1 = new ArrayList<integer>();
var1.add(1);
var1.add(2);
var1.add(3);
var1.add(0, 4);
for (int i = 0; i < var1.size(); i++) {
System.out.println(var1.get(i).intValue());
}
// LinkedList
LinkedList<string> var2 = new LinkedList<string>();
var2.add("str1");
var2.add("str2");
var2.add("str3");
for (int i = 0; i < var2.size(); i++) {
System.out.println(var2.get(i).toString());
}
// Stack
LinkedList<string> stack1 = new LinkedList<string>();
stack1.push("stack1");
stack1.push("stack2");
stack1.push("stack3");
while (!stack1.isEmpty()) {
System.out.println(stack1.pop());
}
// Queue
LinkedList<string> queue1 = new LinkedList<string>();
queue1.offer("queue1");
queue1.offer("queue2");
queue1.offer("queue3");
while (!queue1.isEmpty()) {
System.out.println(queue1.poll());
// System.out.println(queue1.peek());
// peek() 메서드는 가져오기만 하므로 무한루프
}
}
}