title: Java 8 stream API, how to collect List to Object with several List fields
body: <p>I want to get one Object with List&lt;> fields from list of objects with no List&lt;> fields.</p>
  
  <p>This is my code:</p>
  
  <pre><code>public class ObjectDTO {
      private List&lt;String&gt; ids;
      private List&lt;Date&gt; times;
      private List&lt;String&gt; names;
      private List&lt;String&gt; details;
  
  public class ObjectDTOHelper {
          private String id;
          private Date time;
          private String name;
          private String detail;
  }
  </code></pre>
  
  <p>I supply <code>List&lt;ObjectDTOHelper&gt;</code> as input and want to get output just an object of <code>ObjectDTO</code>.</p>
  
  <p>Which I can solve with multiple independent stream functions:</p>
  
  <pre><code>List&lt;ObjectDTOHelper&gt; helpers; //about 1000 elements
  
  List&lt;String&gt; ids= helpers.stream().map(h -&gt; h.id).collect(toList());
  List&lt;Date&gt; times= helpers.stream().map(h -&gt; h.time).collect(toList());
  List&lt;String&gt; names= helpers.stream().map(h -&gt; h.name).collect(toList());
  List&lt;String&gt; details= helpers.stream().map(h -&gt; h.detail).collect(toList());
  
  new ObjectDTO(ids, times, name, detail)
  </code></pre>
  
  <p>Which I think is not the best solution, because I need do that more 100_000 times)  </p>
  
  <p>Can you help solve this more optimally?</p>