code: public OptionalInt maxByInt(IntUnaryOperator keyExtractor) {
          int[] result = collect(() -> new int[3], (acc, i) -> {
              int key = keyExtractor.applyAsInt(i);
              if (acc[2] == 0 || acc[1] < key) {
                  acc[0] = i;
                  acc[1] = key;
                  acc[2] = 1;
              }
          }, (acc1, acc2) -> {
              if (acc2[2] == 1 && (acc1[2] == 0 || acc1[1] < acc2[1]))
                  System.arraycopy(acc2, 0, acc1, 0, 3);
          });
          return result[2] == 1 ? OptionalInt.of(result[0]) : OptionalInt.empty();
      }
docs: Returns the maximum element of this stream according to the provided key
  extractor function.
  
  <p>
  This is a terminal operation.
  
  @param keyExtractor a non-interfering, stateless function
  @return an {@code OptionalInt} describing the first element of this
  stream for which the highest value was returned by key extractor,
  or an empty {@code OptionalInt} if the stream is empty
  @since 0.1.2