title: Java 8 nested streams : return a value in last stream
body: <p>This question can be considered as based on <a href="https://stackoverflow.com/questions/27234931/java-8-nested-streams">java 8 nested streams</a></p>
  
  <p>Suppose I have a <code>Batch</code> with <code>Basket</code>s with <code>Item</code>s :</p>
  
  <pre><code>public class Batch {
      private List&lt;Basket&gt; baskets;
  }
  
  public class Basket {
      private List&lt;Item&gt; items; 
  }
  
  public class Item {
      private String property;
      private int value;
  }
  </code></pre>
  
  <p>I would like to rewrite this method with Java 8 streams.</p>
  
  <pre><code>public class SomeService {
      public int findValueInBatch(Batch batch) {
          for (Basket basket : batch.getBaskets()) {
              for (Item item : basket.getItems()) {
                  if (item.getProperty().equals("someValue") {
                      return item.getValue();
                  }
              }
          }
          return 0;
      }
  }
  </code></pre>
  
  <p>How should I do it ?</p>
  
  <p>First step to where I'd like to go :</p>
  
  <pre><code>public int findValueInBatch(Batch batch) {
      for (Basket basket : batch.getBaskets()) {
          basket.getItems().stream()
              .filter(item -&gt; item.getProperty.equals("someValue") 
              .findFirst()
              .get();
              // there I should 'break'
      }
  }
  </code></pre>
  
  <p>Thanks a lot.</p>