Spliterator implementations

Brian Goetz brian.goetz at oracle.com
Wed Jan 2 15:58:26 PST 2013


Thanks for making this list.

There's no method for spliterator(), instead there is a method for 
stream() which may or may not require a spliterator.  There are defaults 
(based on Iterator) in Collection, List, Set, and SortedSet, plus 
optimized implementations in ArrayList and Vector.  Plus Stack inherits 
from Vector.

 From your list, there are a few that might benefit enough from a better 
implementation to be worth the effort, such as Enum{Set,Map}, 
{Hash,Tree,LinkedHash}{Set,Map}.  For most of the rest (and some of 
these, probably), the Iterator version is probably good enough.



On 1/2/2013 4:04 PM, Doug Lea wrote:
>
> In the midst of trying various approaches for
> ConcurrentSkipList* spliterators (six or more methods
> supplying them!) I pasted the "All Known Implementing Classes"
> list from JDK7 Collection and Map javadocs and threw this list
> together of classes that may need spliterator implementations.
> (or may not, depending on defaults).
> As far as I know, exactly two (ArrayList and CHM) are
> complete and in use at the moment.
> In case you are interested, here it is:
>
>
> For top-level classes only:
>    j.u.c/jsr166:
>      ArrayDeque,
>      ArrayBlockingQueue,
>      ConcurrentLinkedDeque,
>      ConcurrentLinkedQueue,
>      CopyOnWriteArraySet,
>      DelayQueue,
>      LinkedBlockingDeque,
>      LinkedBlockingQueue,
>      LinkedTransferQueue,
>      PriorityBlockingQueue,
>      PriorityQueue,
>      SynchronousQueue
>    j.u:
>      AbstractCollection,
>      AbstractQueue,
>      AbstractSet,
>      EnumSet,
>      HashSet (delegates to HashMap.keySet),
>      LinkedHashSet (delegates to LinkedHashMap.keySet)
>      Stack,
>    other jdk:
>      BeanContextSupport (delegates to HashMap.keySet)
>      BeanContextServicesSupport (super BeanContextSupport)
>      JobStateReasons, (super HashSet)
>
> For both top-level and subList classes
>    j.u.c/jsr166
>      CopyOnWriteArrayList,
>    j.u:
>      AbstractList,
>      AbstractSequentialList,
>      ArrayList,
>      AttributeList,
>      LinkedList,
>      Stack (super Vector),
>      Vector
>    other jdk:
>      RoleList (super ArrayList),
>      RoleUnresolvedList (super ArrayList),
> For both top-level and subSet classes:
>    j.u.c/jsr166
>      ConcurrentSkipListSet,
>      TreeSet
> For keySet, values and entrySet views of:
>    j.u.c/jsr166
>      ConcurrentHashMap,
>    j.u:
>      AbstractMap,
>      EnumMap,
>      HashMap,
>      Hashtable,
>      IdentityHashMap,
>      LinkedHashMap, (super HashMap but cannot use same Spliterator)
>      WeakHashMap
>    other jdk:
>      Attributes (delegates to HashMap)
>      AuthProvider (super Provider)
>      PrinterStateReasons, (super HashMap)
>      Properties, (super Hashtable)
>      Provider (super Properties),
>      RenderingHints (delegates to HashMap)
>      SimpleBindings (delegates to any Map),
>      TabularDataSupport, (delegates to
>      UIDefaults, (super Hashtable)
> For keySet, values and entrySet views, plus the same for subMap views:
>    j.u.c/jsr166
>      ConcurrentSkipListMap,
>      TreeMap,
>
>
>


More information about the lambda-libs-spec-experts mailing list