Java ArrayBlockingQueue.add(E e)
Syntax
ArrayBlockingQueue.add(E e) has the following syntax.
public boolean add(E e)
Example
In the following code shows how to use ArrayBlockingQueue.add(E e) method.
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
//from ww w . j a v a 2 s .c om
public class Main {
public static void main(String[] argv) throws Exception {
int capacity = 100;
BlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(capacity);
for (int i = 0; i < 100; i++) {
queue.add(i);
}
}
}