In the ImmutableRangeSet.Builder source code we have this comment:
That sounds like a neat improvement onto itself. But the ImmutableRangeSet collector introduced in #2750 is also defined in terms of ImmutableRangeSet.Builder:
So as it stands one can only use toImmutableRangeSet() to collect a stream of non-overlapping ranges; otherwise an IllegalArgumentException is thrown. This is somewhat unintuitive from an API point of view. Maybe the introduction of the collector increases the utility of the builder sufficiently to justify spending time on adding support for overlapping ranges?
If I understand right, we have at least two separate questions:
@kevinb9n exactly! I guess I should have summarized this more clearly myself.
Most helpful comment
If I understand right, we have at least two separate questions: