Create new Array Blocking Queue - Java java.util

Java examples for java.util:Collection Creation

Description

Create new Array Blocking Queue

Demo Code


//package com.java2s;

import java.util.Collection;

import java.util.concurrent.ArrayBlockingQueue;

public class Main {
    public static void main(String[] argv) {
        int capacity = 42;
        System.out.println(newArrayBlockingQueue(capacity));
    }/*from   w w w  .  j  ava  2  s .c  o m*/

    public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(
            final int capacity) {
        return new ArrayBlockingQueue<E>(capacity);
    }

    public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(
            final int capacity, final boolean fair) {
        return new ArrayBlockingQueue<E>(capacity, fair);
    }

    public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(
            final int capacity, final boolean fair,
            final Collection<? extends E> c) {
        return new ArrayBlockingQueue<E>(capacity, fair, c);
    }
}

Related Tutorials