Hi Chris, On May 27, 2013, at 4:30 PM, Chris Hegarty <[email protected]> wrote: > 2) KeySetView.spliterator() > > I guess the API should also report CONCURRENT, NONNULL & SUBSIZED? > And the implementation should return SIZED too? > > 3) Value/EntrySpliterator.spliterator() should return SIZED? >
The CHM spliterators cannot report SIZED/SUBSIZED. On construction of a root spliterator a snapshot of the size is obtained and that size is used as the estimate, but elements can be concurrently added/removed after the size is obtained and during operations on the spliterator. Furthermore, even if the size was known at the root, the spliterators cannot report SUBSIZED since the size at the root spliterator is used as an size estimate for sub-splits, "est >>>= 1", with the assumption that the node table contains an ~ uniform distribution of nodes. See the spliterators of HashMap for such a case when there size is known at the root but not for sub-splits. Size estimates are used when it is costly/impractical to maintain and/or calculate exact sizes. Hth, Paul.
