title: Iterate nested object in java8
body: <p>I'm new to java8.<br/>
  I have the following classes. </p>
  
  <pre><code>class User {
    List&lt;Vehicle&gt; vehicle;
    private int vehiclecount;
  
    public List&lt;Vehicle&gt; getVehicle() {
          return vehicle;
    }
  }
  
  class Vehicle{
    String vehiclename;
    String vehiclecolor;
  }
  </code></pre>
  
  <p>I am able to save this in mongo collection:</p>
  
  <pre><code>{ "_id" : ObjectId("59ca1e53a1a79607fcc9200f"), "_class" : "com.test.User", 
     "vechicle" : [ { "vehiclename" : "Car", "vehiclecolor" : "Blue" } ], 
     "count" : 1, "createdDate" : ISODate("2017-09-26T09:30:59.826Z") } 
  </code></pre>
  
  <p>Now i pulled out the result based on spring mongo data repository. i want to iterate the above mongo collection so that i can only get the vehicle list 
  I tried the below:</p>
  
  <pre><code>List&lt;Vehicle&gt; vehicle = result.stream().filter(vehicles-&gt;vehicles.getVehicle().stream().collect(Collectors.toList());
  </code></pre>
  
  <p>Please help im new to java8. Thanks in advance</p>