A little late, but still ... It also puzzled me. I will list those that I know of:
HashMap (as noted above) and as such IdentityHashMap , LinkedHashMap and TreeMap .
It should be noted here that ConcurrentHashMap not listed because it allows simultaneous updates, so its size is actually equal to the size at the time of the call. In fact, CHM does not explicitly report SIZED .
Then there are those related to Map , for example HashSet and TreeSet , because inside they are still Maps.
And then there is one that is not expected a bit here, in the face of BitSet , for which BitSetSpliterator#characteristics looks like:
@Override public int characteristics() { // Only sized when root and not split return (root ? Spliterator.SIZED : 0) | Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.SORTED; }
This may sound funny, but the explanation is as follows:
// Raise the index of this spliterator to be the next set bit // from the mid point index = nextSetBit(mid, wordIndex(hi - 1));
So, for BitSet this will happen only once, and there is no point in reporting SUBSIZED , because the split will not occur exactly in the middle.
Quite the opposite: do not report SUBSIZED , but not SIZED , so no one (as I understand it in the code) does this.
source share