I'm reading the book "Mastering Lambdas: Java Programming in a Multicore World". It has simple example of collecting stream of books to list :
List<Book> bookList = libraryStream.collect(Collectors.toList());
And I quote from the book:
the stream operations can be safely executed in parallel, even if the List into which the stream elements are accumulated (ArrayList is used in the current implementation) is not threadsafe.
I don't understand how it can be thread safe after the returned list it modified from multiple thread if collecting using parallel stream.