@Override
 public OptionalInt findAny() {
   Integer result =
       performOperation(
           TerminalFunctions.findAnyIntFunction(),
           false,
           (i1, i2) -> {
             if (i1 != null) {
               return i1;
             } else {
               return i2;
             }
           },
           a -> a != null);
   if (result != null) {
     return OptionalInt.of(result);
   } else {
     return OptionalInt.empty();
   }
 }
 @Override
 public OptionalInt max() {
   Integer value =
       performOperation(
           TerminalFunctions.maxIntFunction(),
           false,
           (i1, i2) -> {
             if (i1 != null) {
               if (i2 != null) {
                 return i1 > i2 ? i1 : i2;
               }
               return i1;
             }
             return i2;
           },
           null);
   if (value == null) {
     return OptionalInt.empty();
   } else {
     return OptionalInt.of(value);
   }
 }
 @Override
 public OptionalInt reduce(IntBinaryOperator op) {
   Integer result =
       performOperation(
           TerminalFunctions.reduceFunction(op),
           true,
           (i1, i2) -> {
             if (i1 != null) {
               if (i2 != null) {
                 return op.applyAsInt(i1, i2);
               }
               return i1;
             }
             return i2;
           },
           null);
   if (result == null) {
     return OptionalInt.empty();
   } else {
     return OptionalInt.of(result);
   }
 }