title: collecting from parallel stream in java 8
body: <p>I want to take an input and apply parallel stream on that, then I want output as list. Input could be any List or any collection on which we can apply streams.</p>
  
  <p>My concerns here is that if we want output as map them we have an option from java is like </p>
  
  <pre><code>list.parallelStream().collect(Collectors.toConcurrentMap(args))
  </code></pre>
  
  <p>But there is no option that I can see to collect from parallel stream in thread safe way to provide list as output.
  I see one more option there to use </p>
  
  <p><code>list.parallelStream().collect(Collectors.toCollection(&lt;Concurrent Implementation&gt;))</code></p>
  
  <p>in this way we can provide various concurrent implementations in collect method. But I think there is only CopyOnWriteArrayList List implementation is present in java.util.concurrent. We could use various queue implementation here but those will not be like list. What I mean here is that we can workaround to get the list.</p>
  
  <p>Could you please guide me what is the best way if I want the output as list?</p>
  
  <p>Note: I could not find any other post related to this, any reference would be helpful.</p>