title: Stream / Reduce a series of functions applied to an input value with bound variables in Java
body: <p>How does one go about rewriting this loop using a stream.</p>
  <pre><code>private final List&lt;RegionSpecificValidator&gt; validators;
  public Item applyValidations(Item inbound, Holder holder, Product product) {
      Item toValidate = inbound;
      for (var validator: validators)
          toValidate = validator.validate(toValidate, holder, product);
      return toValidate;
  }
  </code></pre>
  <p>It should be possible to rewrite this loop using <code>validators.stream().reduce(...)</code></p>
  <p>I have tried using the guidance here, but I cannot figure out what BiFunction interface needs to be implemented and how.<br />
  The interface as it currently stands looks like this:</p>
  <pre><code>public interface RegionSpecificValidator {
      Item validate(Item toValidate, Holder holder, Product product);
  }
  </code></pre>
  <p>I have looked at this guidance: <a href="https://stackoverflow.com/questions/24006489/reducing-a-list-of-unaryoperators-in-java-8">Reducing a list of UnaryOperators in Java 8</a><br />
  However it's not clear how I implement <code>andThen</code> in this case, or even if it's possible.</p>