BlockingQueue.drainTo

Removes at most the given number of available elements from this queue and adds them to the given collection. A failure encountered while attempting to add elements to collection {@code c} may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in {@code IllegalArgumentException}. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.

@param c the collection to transfer elements into @param maxElements the maximum number of elements to transfer @return the number of elements transferred @throws UnsupportedOperationException if addition of elements is not supported by the specified collection @throws ClassCastException if the class of an element of this queue prevents it from being added to the specified collection @throws NullPointerException if the specified collection is null @throws IllegalArgumentException if the specified collection is this queue, or some property of an element of this queue prevents it from being added to the specified collection

  1. int drainTo(Collection!(E) c)
  2. int drainTo(Collection!(E) c, int maxElements)
    interface BlockingQueue(E)
    int
    drainTo

Meta