Collection framework
.png)
Queue interface

- Represents utility data structures (like Stack, Queue, ...) data structure.
- Implementations: LinkedList, ArrayDeque, PriorityQueue.
- Can be accessed using iterator, but no random access.
Methods:
.png)
.png)
- boolean add(E e) - throw IllegalStateException if full.
- E remove() - throw NoSuchElementException if empty
- E element() - throw NoSuchElementException if empty
- boolean offer(E e) - return false if full.
- E poll() - returns null if empty
- E peek() - returns null if empty
In queue, addition and deletion is done from the different ends (rear and front).
Deque interface
.png)
- Represents double ended queue data structure i.e. add/delete can be done from both the ends.