code: public static <T> long drain(Source<T> source,
                                   final Collection<T> collection)
              throws IOException {
          return drain(source, new AbstractSink<T>() {
              @Override
              public void put(T item) {
                  collection.add(item);
              }
          });
      }
docs: Exhausts the given source, adding each item to the given collection.
  <p>
  The source will be automatically closed regardless of success.
  
  @param source the source to exhaust.
  @param collection the collection add each item to.
  @param <T> the type.
  @return the number of items encountered.
  @throws IOException if an I/O problem occurs.