I think the other PR clarifies this a bit. Basically, the way this works is that when a SketchMap is constructed, that SortedSet is immutable not just in the sense that it is, well, immutable, but that adding elements to it without following the algorithm in SketchMapMonoid will be wrong (I'm not sure how to get around this). This is because we do not have any information on V here, but that is how these things are sorted. So basically we're giving them back a set sorted on the value of V in the adapted matrix, but without V being present. Given this invariant, it doesn't matter that when we have an empty SortedSet it has a bunk ordering, because we'll have the proper ordering later when we use SketchMapMonoid.plus (which is where the other comment about the iterator applies -- we do that since the ordering is stale once we add new elements).