Deque<E> deque1 = new ArrayDeque<>();
Deque<E> deque2 = new LinkedBlockingDeque<>();
Deque<E> deque3 = new ConcurrentLinkedDeque<>();
Deque<E> linkedList = new LinkedList<>();
ν(Queue)μ μ€ν(Stack)μ ν©μ³ λμ ννλ‘ νμ μμͺ½μμ λ°μ΄ν°λ₯Ό λ£κ³ λΊ μ μλ€.
νμ | λ©μλ | μ€λͺ |
---|---|---|
E | push(E value) & addFirst(E value) | 맨 μμ value μΆκ°νλ©° μ€ν¨(μ©λ μ΄κ³Ό) μ Exception μλ¬ λ°ν |
E | add(E value) & addLast(E value) | 맨 λ€μ value μΆκ°νλ©° μ€ν¨(μ©λ μ΄κ³Ό) μ Exception μλ¬ λ°ν |
boolean | offerFirst(E value) | 맨 μμ value μΆκ°νλ©° μ±κ³΅ μ true, μ€ν¨ μ false λ°ν |
boolean | offer(E value) & offerLast(E value) | 맨 λ€μ λ°μ΄ν° μΆκ°νλ©° μ±κ³΅ μ true, μ€ν¨ μ false λ°ν |
E | push(E value) | 맨 μ λ°μ΄ν°λ₯Ό λ°ννκ³ νμμ μ κ±°, νκ° λΉμ΄μλ€λ©΄ null λ°ν |
void | pop() & remove() & removeFirst() | 맨 μ λ°μ΄ν° μ κ±°, μ€ν¨(λΉμ΄ μμ) μ Exception μλ¬ λ°ν |
void | poll() & pollFirst() | 맨 μ λ°μ΄ν° μ κ±°, μ€ν¨ μ null λ°ν |
void | removeLast() | 맨 λ€ λ°μ΄ν° μ κ±°, μ€ν¨ μ Exception μλ¬ λ°ν |
void | pollLast() | 맨 λ€ λ°μ΄ν° μ κ±°, μ€ν¨ μ null λ°ν |
void | removeFirstOccurrence(E value) | μ μͺ½μμ valueμ κ°μ λ°μ΄ν°λ₯Ό μ°Ύμ μ κ±° |
void | remove(E value) & removeLastOccurrence(E value) | λ€ μͺ½μμ valueμ κ°μ λ°μ΄ν°λ₯Ό μ°Ύμ μ κ±° |
E | getFirst() | 맨 μ λ°μ΄ν° νμΈ, μ€ν¨ μ Exception μλ¬ λ°ν |
E | peek() & peekFirst() | 맨 μ λ°μ΄ν° νμΈ, μ€ν¨ μ null λ°ν |
E | getLast() | 맨 λ€ λ°μ΄ν° νμΈ, μ€ν¨ μ Exception μλ¬ λ°ν |
E | peekLast() | 맨 λ€ λ°μ΄ν° νμΈ, μ€ν¨ μ null λ°ν |
E | contain(E value) | valueμ κ°μ λ°μ΄ν°κ° ν¬ν¨λμ΄ μλ μ§ νμΈ |
E | size() | λ±μ ν¬κΈ° λ°ν |