A Queue class is a collection acting just like a buffer, it may accepts the LinkedList object and keep the items in an ordered fashions. It's first item can be viewed or removed
Example

import java.io.*;
import java.util.List;
import java.util.*;
import java.util.ArrayList;
import java.util.Queue.*;// Queue
public class Test_This {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
Process p1 = new Process();
p1.method_1();
}
}
class Process
{
String[] first = {"a","e", "c","b","d"};
public Process()
{
System.out.println("Default) constructor");
}
public void method_1()
{
LinkedList list = new LinkedList();
Queue q = new LinkedList();
System.out.println("Sort arrays ");
Arrays.sort(first);
for(int i = 0; i < first.length; i++)
{
q.add(first[i]);
//System.out.println("print " +q.peek());
//q.poll();
}
//list.push("zeta");
System.out.println("Queue peek():just views the first item: " + q.peek());
System.out.println("Queue poll():views and removes the first item: " + q.poll());
System.out.print("the first item reemoved " );
System.out.println(" \t" +q);
}
}
 

If you let peek and poll run in a loop, it will chew up the top element in a sequence, as show below

System.out.println("print " +q.peek());
q.poll();