Code example for ArrayBlockingQueue

0
    Collection<Queue<Boolean>> queues() {
        List<Queue<Boolean>> queues = new ArrayList<Queue<Boolean>>();
        queues.add(new ConcurrentLinkedDeque<Boolean>());
        queues.add(new ConcurrentLinkedQueue<Boolean>());
        queues.add(new ArrayBlockingQueue<Boolean>(count, false));
        queues.add(new ArrayBlockingQueue<Boolean>(count, true));
        queues.add(new LinkedBlockingQueue<Boolean>());
        queues.add(new LinkedBlockingDeque<Boolean>());
        queues.add(new PriorityBlockingQueue<Boolean>());
        queues.add(new PriorityQueue<Boolean>());
        queues.add(new LinkedList<Boolean>());
        queues.add(new LinkedTransferQueue<Boolean>());
 
        // Following additional implementations are available from: 
        // http://gee.cs.oswego.edu/dl/concurrency-interest/index.html 
        // queues.add(new SynchronizedLinkedListQueue<Boolean>()); 
 
        // Avoid "first fast, second slow" benchmark effect. 
        Collections.shuffle(queues);
        return queues;
    }