title: From for loop to Java 8 Stream example
body: <p>I would like a simple example for Java 8 <code>Streams</code> to understand it. I have this code that returns a free taxi. I would like to replace this for loop with equivalent code that uses Java 8 streams :</p>
  
  <pre><code>private List&lt;Taxi&gt; taxis = new ArrayList&lt;Taxi&gt;();
  
  Taxi scheduleTaxi(){
      for (Taxi taxi : taxis) {
          if (taxi.isFree()) {
              return taxi;
          }
      }
      return null;
  }
  </code></pre>
  
  <p>I iterate over a list of <code>taxis</code>, and evaluate if <code>taxi</code> respects the condition. If the condition applies, I stop the loop and return <code>taxi</code>.</p>
  
  <p>Any suggestions?</p>