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.
My co
The Collection object used to receive the data being collected does not need to be concurrent. You can give it a simple ArrayList.
That is because the collection of values from a parallel stream is not actually collected into a single Collection object. Each thread will collect their own data, and then all sub-results will be merged into a single final Collection object.
This is all well-documented in the Collector javadoc, and the Collector is the parameter you're giving to the collect() method:
R collect(Collector super T,A,R> collector)