1import java.util.*;
2
3Queue<Integer> queue = new LinkedList<Integer>();
4// use non-primative types when constructing
5
6// to add a value to the back of queue:
7queue.add(7);
8
9// to remove and return front value:
10int next = queue.remove();
11
12// to just return front value without removing:
13int peek = queue.peek();
1The Queue interface is available in java.util package and extends the Collection interface. The queue collection is used to hold the elements about to be processed and provides various operations like the insertion, removal etc. It is an ordered list of objects with its use limited to insert elements at the end of the list and deleting elements from the start of list i.e. it follows the FIFO or the First-In-First-Out principle.
2
3LinkedList, ArrayBlockingQueue and PriorityQueue are the most frequently used implementations.