docs: public static <E> int drainQueue(Queue<E> queue,
                                       int elementsToDrain,
                                       Predicate<E> drainedCountFilter) {
          int drained = 0;
          boolean drainMore = true;
          for (int i = 0; i < elementsToDrain && drainMore; i++) {
              E polled = queue.poll();
              if (polled != null) {
                  if (drainedCountFilter == null || drainedCountFilter.test(polled)) {
                      drained++;
                  }
              } else {
                  drainMore = false;
              }
          }
  
          return drained;
      }