I’ve recently been learning about various libraries for concurrency in Java such as ConcurrentHashMap and the lovely non blocking one from Cliff Click
I don’t know much about Scala but I’ve heard good things about the recent parallel collections library.
I’d like to know what are some major advantages that this library would give over Java based libraries?
The two collections are for different uses.
Java’s concurrent collections allow you to use them from a parallel context: many threads can access them simultaneously, and the collection will be sure to do the right thing (so the callers don’t have to worry about locks and such).
Scala’s parallel collections, in contrast, are designed to run high-order operations on themselves without you having to worry about creating threads. So you can write something like:
and the filter and map will each execute in parallel (but the filter will complete before the map starts).