docs: public <E extends T> List<E> leastOf(Iterable<E> iterable, int k) {
      if (iterable instanceof Collection) {
        Collection<E> collection = (Collection<E>) iterable;
        if (collection.size() <= 2L * k) {
          // In this case, just dumping the collection to an array and sorting is
          // faster than using the implementation for Iterator, which is
          // specialized for k much smaller than n.
  
          @SuppressWarnings("unchecked") // c only contains E's and doesn't escape
          E[] array = (E[]) collection.toArray();
          Arrays.sort(array, this);
          if (array.length > k) {
            array = ObjectArrays.arraysCopyOf(array, k);
          }
          return Collections.unmodifiableList(Arrays.asList(array));
        }
      }
      return leastOf(iterable.iterator(), k);
    }