[concurrency-interest] ConcurrentHashMapV8 now supports Spliterator

Doug Lea dl at cs.oswego.edu
Tue Jul 3 19:47:51 EDT 2012


In addition to including the compute/computeIfAbsent changes
discussed on this list last week, the updated version of
ConcurrentHashMapV8 contains basic support for performing
parallel (normally via ForkJoin) operations on the keys,
values, or entries of a map.

The added Spliterator interface (see
http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166edocs/jsr166e/ConcurrentHashMapV8.Spliterator.html)
is for now a nested interface that contains a subset of
some functionality likely to be available in JDK8.
There are also three new methods to provide them:
   public Spliterator<K> keySpliterator()
   public Spliterator<V> valueSpliterator()
   public Spliterator<Map.Entry<K,V>> entrySpliterator()
See the Spliterator javadocs for a usage example.

These methods only provide a foothold for writing your
own parallel operations. CHMV8 doesn't now itself supply
the map, filter, reduce, forEach, etc operations expected
to be supported under JDK8 lambda-ized collections. However,
they do enable those familiar with ForkJoin programming
to get a head start evaluating such code you write yourself.
If you do this, please report back any interesting experiences.

The usual links:
     *  API specs:  http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166edocs/
     * jar file: http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166e.jar (compiled 
using Java7 javac).
     * Browsable CVS sources: 
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/

-Doug



More information about the Concurrency-interest mailing list