Java Queue.remove()

Syntax

Queue.remove() has the following syntax.

E remove()

Example

In the following code shows how to use Queue.remove() method.


import java.util.LinkedList;
import java.util.Queue;
//from   ww w .ja v  a2  s .co  m
public class Main {
  public static void main(String[] args) {
    Queue<String> queue = new LinkedList<String>();
    queue.offer("First");
    queue.offer("Second");
    queue.offer("Third");
    queue.offer("Fourth");

    queue.remove();
    
    System.out.println(queue);
  }
}

The code above generates the following result.