title: Java Collect Joining Custom Function
body: <p>I've created the following function:</p>
  
  <pre><code>private BooleanExpression createExpresionByJoiningOf(List&lt;BooleanExpression&gt; expresionsForEachStatus) {
          BooleanExpression inAnyOfSelectedStatus = expresionsForEachStatus.get(0);
          for (int i = 1; i &lt; expresionsForEachStatus.size(); i++) {
              inAnyOfSelectedStatus = inAnyOfSelectedStatus.or(expresionsForEachStatus.get(i));
          }
          return inAnyOfSelectedStatus;
      }
  </code></pre>
  
  <p>The bolleanExpresion list that it is being pass to the method have been created by stream function:</p>
  
  <pre><code>    List&lt;BooleanExpression&gt; expresionsForEachStatus = originalList.stream()
       .map(statusToBoleanExpresion)
       .collect(Collectors.toList());
  </code></pre>
  
  <p>My question is how would you create a custom Collector to join the BolleanExpresions of that list. So, I would have something like this:</p>
  
  <pre><code>originalList.stream()
    .map(statusToBoleanExpresion)
    .collect(joinedBooleanExpresion());
  </code></pre>
  
  <p>Thank you!</p>