/** * Creates a <tt>LinkedBlockingQueue</tt> with a capacity of * {@link Integer#MAX_VALUE}, initially containing the elements of the * given collection, * added in traversal order of the collection's iterator. * * @param c the collection of elements to initially contain * @throws NullPointerException if the specified collection or any * of its elements are null */ public LinkedBlockingQueue(Collection c) { this(Integer.MAX_VALUE); for (Iterator itr = c.iterator(); itr.hasNext();) { Object e = itr.next(); add(e); } }
/** * Creates a <tt>LinkedBlockingQueue</tt> with a capacity of * {@link Integer#MAX_VALUE}, initially containing the elements of the * given collection, * added in traversal order of the collection's iterator. * * @param c the collection of elements to initially contain * @throws NullPointerException if the specified collection or any * of its elements are null */ public LinkedBlockingQueue(Collection c) { this(Integer.MAX_VALUE); for (Iterator itr = c.iterator(); itr.hasNext();) { Object e = itr.next(); add(e); } }
/** * Creates a <tt>LinkedBlockingQueue</tt> with a capacity of * {@link Integer#MAX_VALUE}, initially containing the elements of the * given collection, * added in traversal order of the collection's iterator. * * @param c the collection of elements to initially contain * @throws NullPointerException if the specified collection or any * of its elements are null */ public LinkedBlockingQueue(Collection c) { this(Integer.MAX_VALUE); for (Iterator itr = c.iterator(); itr.hasNext();) { Object e = itr.next(); add(e); } }
/** * Reconstitute this queue instance from a stream (that is, * deserialize it). * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { // Read in capacity, and any hidden stuff s.defaultReadObject(); synchronized (this) { count = 0; } last = head = new Node(null); // Read in all elements and place in queue for (;;) { Object item = (Object)s.readObject(); if (item == null) break; add(item); } }
/** * Reconstitute this queue instance from a stream (that is, * deserialize it). * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { // Read in capacity, and any hidden stuff s.defaultReadObject(); synchronized (this) { count = 0; } last = head = new Node(null); // Read in all elements and place in queue for (;;) { Object item = (Object)s.readObject(); if (item == null) break; add(item); } }
/** * Reconstitute this queue instance from a stream (that is, * deserialize it). * @param s the stream */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { // Read in capacity, and any hidden stuff s.defaultReadObject(); synchronized (this) { count = 0; } last = head = new Node(null); // Read in all elements and place in queue for (;;) { Object item = (Object)s.readObject(); if (item == null) break; add(item); } }