The Queue is an interface, it is present in java.util package and it extends the Collection interface. Queue will process the elements in FIFO(First In First Out) order.
Queue interface classes.
In queues, elements are stored and accessed in First In, First Out manner. That is, elements are added from the behind and removed from the front.
We must import java.util.Queue package in order to use Queue
// LinkedList implementation of Queue
Queue<String< animal1 = new LinkedList<>();
// Array implementation of Queue
Queue<String< animal2 = new ArrayDeque<>();
// Priority Queue implementation of Queue
Queue<String< animal 3 = new PriorityQueue<>();
Some of the commonly used methods of the Queue interface are: