code: public Optional<T> maxByInt(ToIntFunction<? super T> keyExtractor) {
          return Box.asOptional(reduce(null, (ObjIntBox<T> acc, T t) -> {
              int val = keyExtractor.applyAsInt(t);
              if (acc == null)
                  return new ObjIntBox<>(t, val);
              if (val > acc.b) {
                  acc.b = val;
                  acc.a = t;
              }
              return acc;
          }, (ObjIntBox<T> acc1, ObjIntBox<T> acc2) -> (acc1 == null || acc2 != null && acc1.b < acc2.b) ? acc2 : acc1));
      }
docs: Returns the maximum element of this stream according to the int 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 max(Comparator.comparingInt(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 int keys from this stream elements
  @return an {@code Optional} describing the maximum element of this
  stream, or an empty {@code Optional} if the stream is empty
  @throws NullPointerException if the maximum element is null