code: public Optional<T> minByDouble(ToDoubleFunction<? super T> keyExtractor) {
          return Box.asOptional(reduce(null, (ObjDoubleBox<T> acc, T t) -> {
              double val = keyExtractor.applyAsDouble(t);
              if (acc == null)
                  return new ObjDoubleBox<>(t, val);
              if (Double.compare(val, acc.b) < 0) {
                  acc.b = val;
                  acc.a = t;
              }
              return acc;
          }, (ObjDoubleBox<T> acc1, ObjDoubleBox<T> acc2) -> (acc1 == null || acc2 != null
              && Double.compare(acc1.b, acc2.b) > 0) ? acc2 : acc1));
      }
docs: Returns the minimum element of this stream according to the double values
  extracted by provided function. This is a special case of a reduction.
  
  <p>
  This is a terminal operation.
  
  <p>
  This method is equivalent to
  {@code min(Comparator.comparingDouble(keyExtractor))}, but may work
  faster as keyExtractor function is applied only once per each input
  element.
  
  @param keyExtractor a <a
  href="package-summary.html#NonInterference">non-interfering </a>,
  <a href="package-summary.html#Statelessness">stateless</a>
  function to extract the double keys from this stream elements
  @return an {@code Optional} describing the minimum element of this
  stream, or an empty {@code Optional} if the stream is empty
  @throws NullPointerException if the minimum element is null