Hierarchy
Collection Interface
↓
Queue Interface
↓
Deque Interface
↓
LinkedList class
Declaration as Queue
Queue q = new LinkedList();
Queue does NOT support indexing
So these are invalid concepts for Queue:
❌get(0)
❌add(2, value)
❌remove(1)
Queues work only:
front insertion/removal
FIFO operations
You process elements sequentially.
You don't jump to middle positions.
Queue Operations
Method ** Purpose**
add() Insert element
offer() Insert safely
poll() Remove first element
remove() Remove first element
peek() View first element
element() View first element

Top comments (0)