The spec for BlockingQueue.java: /** * Removes all available elements from this queue and adds them * into the given collection. This operation may be more * efficient than repeatedly polling this queue. A failure * encountered while attempting to <tt>add</tt> elements to * collection <tt>c</tt> 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 * <tt>IllegalArgumentException</tt>. 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 * @return the number of elements transferred. * @throws NullPointerException if c is null * @throws IllegalArgumentException if c is this queue * */ int drainTo(Collection<? super E> c); is incomplete because this method has to be able to work with any collection, and has to use something like Collection.add to add elements to it, and thus any of the exceptions thrown by that, like UnsupportedOperationException and ClassCastException, must in turn be spec'ed to be thrown by BlockingQueue.drainTo (both variants). Similarly with all extending interfaces and implementing classes. ###@###.### 2005-05-12 23:07:32 GMT
|