Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class collectionExample {
- public static void main(String[] args) {
- ArrayList ListArr = new ArrayList();
- LinkedList ListLinked = new LinkedList();
- Vector ListVector = new Vector();
- Stack ListStack = new Stack();
- ListArr.add(new String("A"));
- System.out.println("ListArr(0) : " + ListArr.get(0));
- ListLinked.add(new String("LA"));
- System.out.println("ListLinked(0) : " + ListLinked.get(0));
- ListVector.add(new String("V"));
- System.out.println("ListLinked(0) : " + ListArr.get(0));
- ListStack.push(new String("1"));
- ListStack.push(new String("2"));
- System.out.println("ListStack(0) : " + ListStack.pop());
- HashSet SetHashSet = new HashSet();
- SetHashSet.add(new String("가"));
- SetHashSet.add(new String("나"));
- SetHashSet.add(new String("다"));
- System.out.println("SetHashSet(0) : " + SetHashSet);
- LinkedHashSet SetLinkedHashSet = new LinkedHashSet();
- SetLinkedHashSet.add(new String("가"));
- SetLinkedHashSet.add(new String("나"));
- SetLinkedHashSet.add(new String("다"));
- System.out.println("SetLinkedHashSet(0) : " + SetLinkedHashSet);
- TreeSet SetTreeSet = new TreeSet();
- SetTreeSet.add(new String("3"));
- SetTreeSet.add(new String("1"));
- SetTreeSet.add(new String("2"));
- System.out.println("SetLinkedHashSet(0) : " + SetTreeSet);
- Queue Que = new LinkedList();
- Que.add(new String("1"));
- Que.add(new String("2"));
- System.out.println("Que(0) : " + Que.poll());
- Deque DeQue = new LinkedList();
- DeQue.add(new String("1"));
- DeQue.add(new String("2"));
- System.out.println("DeQue(0) : " + DeQue.pollFirst());
- System.out.println("DeQue(0) : " + DeQue.pollLast());
- HashMap MapHashMap = new HashMap();
- MapHashMap.put(new String("국어"), new String("10"));
- MapHashMap.put(new String("수학"), new String("20"));
- MapHashMap.put(new String("영어"), new String("30"));
- System.out.println("MapHashMap(0) : " + MapHashMap);
- LinkedHashMap MapLinkedHashMap = new LinkedHashMap();
- MapLinkedHashMap.put(new String("국어"), new String("10"));
- MapLinkedHashMap.put(new String("수학"), new String("20"));
- MapLinkedHashMap.put(new String("영어"), new String("30"));
- System.out.println("MapLinkedHashMap(0) : " + MapLinkedHashMap);
- TreeMap MapTreeMap = new TreeMap();
- MapTreeMap.put(new String("영어"), new String("30"));
- MapTreeMap.put(new String("국어"), new String("10"));
- MapTreeMap.put(new String("수학"), new String("20"));
- System.out.println("MapTreeMap(0) : " + MapTreeMap);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement