Example usage for java.util.concurrent ArrayBlockingQueue remove

List of usage examples for java.util.concurrent ArrayBlockingQueue remove

Introduction

In this page you can find the example usage for java.util.concurrent ArrayBlockingQueue remove.

Prototype

public boolean remove(Object o) 

Source Link

Document

Removes a single instance of the specified element from this queue, if it is present.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int capacity = 10;
    ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(capacity);

    for (int i = 0; i < 10; i++) {
        queue.add(i);/*w w  w .  j  ava2  s.  c  om*/
    }

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