/** * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed) * capacity, the specified access policy and initially containing the * elements of the given collection, * added in traversal order of the collection's iterator. * @param capacity the capacity of this queue * @param fair if <tt>true</tt> then queue accesses for threads blocked * on insertion or removal, are processed in FIFO order; * if <tt>false</tt> the access order is unspecified. * @param c the collection of elements to initially contain * @throws IllegalArgumentException if <tt>capacity</tt> is less than * <tt>c.size()</tt>, or less than 1. * @throws NullPointerException if the specified collection or any * of its elements are null */ public ArrayBlockingQueue(int capacity, boolean fair, Collection c) { this(capacity, fair); if (capacity < c.size()) throw new IllegalArgumentException(); for (Iterator it = c.iterator(); it.hasNext();) add(it.next()); }
/** * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed) * capacity, the specified access policy and initially containing the * elements of the given collection, * added in traversal order of the collection's iterator. * @param capacity the capacity of this queue * @param fair if <tt>true</tt> then queue accesses for threads blocked * on insertion or removal, are processed in FIFO order; * if <tt>false</tt> the access order is unspecified. * @param c the collection of elements to initially contain * @throws IllegalArgumentException if <tt>capacity</tt> is less than * <tt>c.size()</tt>, or less than 1. * @throws NullPointerException if the specified collection or any * of its elements are null */ public ArrayBlockingQueue(int capacity, boolean fair, Collection c) { this(capacity, fair); if (capacity < c.size()) throw new IllegalArgumentException(); for (Iterator it = c.iterator(); it.hasNext();) add(it.next()); }
/** * Creates an <tt>ArrayBlockingQueue</tt> with the given (fixed) * capacity, the specified access policy and initially containing the * elements of the given collection, * added in traversal order of the collection's iterator. * @param capacity the capacity of this queue * @param fair if <tt>true</tt> then queue accesses for threads blocked * on insertion or removal, are processed in FIFO order; * if <tt>false</tt> the access order is unspecified. * @param c the collection of elements to initially contain * @throws IllegalArgumentException if <tt>capacity</tt> is less than * <tt>c.size()</tt>, or less than 1. * @throws NullPointerException if the specified collection or any * of its elements are null */ public ArrayBlockingQueue(int capacity, boolean fair, Collection c) { this(capacity, fair); if (capacity < c.size()) throw new IllegalArgumentException(); for (Iterator it = c.iterator(); it.hasNext();) add(it.next()); }