Java ArrayBlockingQueue .remove (Object o)
Syntax
ArrayBlockingQueue.remove(Object o) has the following syntax.
public boolean remove(Object o)
Example
In the following code shows how to use ArrayBlockingQueue.remove(Object o) method.
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
// w ww. ja v a 2 s .c o m
public class Main {
public static void main(String[] argv) throws Exception {
int capacity = 10;
BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(capacity);
for (int i = 0; i < 10; i++) {
queue.add(i);
}
System.out.println(queue.remove(0));
System.out.println(queue);
}
}
The code above generates the following result.