title: using java8 stream api to convert one object to another
body: <p>I am developing a SpringBoot project.</p>
  
  <p>I have a <code>Car</code> model class:</p>
  
  <pre><code>public class Car {
     private String plateNumber;
     private CarType type;
     private String brand
  }
  </code></pre>
  
  <p>There is a <code>CarType</code> enum:</p>
  
  <pre><code>public enum CarType {
     HATCH_BACK, SEDAN, SUV
  }
  </code></pre>
  
  <p>In my DTO layer, I have a <code>CarDTO</code> class:</p>
  
  <pre><code>public class CarDTO {
         private String plateNumber;
         private String type;
         private String brand
  }
  </code></pre>
  
  <p>(The only difference between <code>Car</code> and <code>CarDTO</code> is that in <code>CarDTO</code> the <code>type</code> property is a <code>String</code> whereas in <code>Car</code> the <code>type</code> property is a <code>CarType</code>).</p>
  
  <p>In Controller, I got a List of CarDTO in request payload:</p>
  
  <pre><code>List&lt;CarDTO&gt; carsFromReq = request.getCars();
  </code></pre>
  
  <p>I would like to get a <code>List&lt;Car&gt;</code> out from <code>List&lt;CarDTO&gt;</code>, how to achieve that with Java8 stream API?</p>