ArrayBlockingQueue.clear() has the following syntax.
public void clear()
In the following code shows how to use ArrayBlockingQueue.clear() method.
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; /*from ww w .j av a 2 s. c o m*/ 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); } queue.clear(); } }