title: Can Java 8 Streams use multiple items from mapping pipeline
body: <p>I have some data stored in a JPA Repository that I am trying to process.  I would like to be able to use Java 8 Streams to do so, but can not figure out how to get the required information.  This particular 'Entity' is actually only for recovery, so it holds items that would need to be processed after something like a power-fail/restart.</p>
  
  <p>Using pre-Java 8 for-loops the code would look like:</p>
  
  <pre><code>    List&lt;MyEntity&gt; deletes = myEntityJpaRepository.findByDeletes();
      for (MyEntity item : deletes) {
          String itemJson = item.getData();
          // use a Jackson 'objectMapper' already setup to de-serialize
          MyEventClass deleteEvent = objectMapper.readValue(itemJson, MyEventClass.class);
          processDelete(deleteEvent, item.getId());                   
      }
  </code></pre>
  
  <p>The problem arises from the two parameter method called at the very end.  Using Streams, I believe I would do:</p>
  
  <pre><code>//      deletes.stream()
  //             .map(i -&gt; i.getData())
  //             .map(event -&gt; objectMapper.readValue(event, MyEventClass.class))
  //             .forEach(??? can't get 'id' here to invoke 2 parameter method);
  </code></pre>
  
  <p>I have a solution (without Streams) that I can live with.  However I would think this problem comes up a lot, thus my question is:  IN GENERAL, is there a way using Streams to accomplish what I am trying to do?  </p>