code: public static <E> int drainQueue(Queue<E> queue, Predicate<E> drainedCountFilter) {
          return drainQueue(queue, queue.size(), drainedCountFilter);
      }
docs: Drains the provided queue by the size of the queue as it is known
  upfront draining.
  <p>
  The rational for using this method is the same as for using
  {@link Queue#clear()}: to remove all the elements from the queue.
  There are two major differences to highlight:
  <ol>
  <li>This method doesn't guarantee that the queue is empty on
  return if it is written concurrently.</li>
  <li>This method returns the number of drained elements, while
  {@link Queue#clear()} doesn't.</li>
  </ol>
  <p>
  These points makes this method more applicable than
  {@link Queue#clear()} is in conditions where the queue is written
  concurrently without blocking the writer threads for the time of
  draining the queue and the caller needs to know the number of
  elements removed from the queue.
  <p>
  You may provide a predicate which will allow some elements to be drained
  but not be counted against the returned number of drained events.
  
  @param queue              The queue to be drained
  @param drainedCountFilter filter which determines if the drained element
  is counted against the returned count. The filter
  may be {@code null} in which case all elements
  match
  @param <E>                the type of the elements in the queue
  @return The number of elements drained from the queue which pass the
  given predicate