public static class ImmutableRangeSet.Builder<C extends Comparable<?>> extends Object
A builder for immutable range sets.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
ImmutableRangeSet.Builder<C> |
add(Range<C> range)
Add the specified range to this builder.
|
ImmutableRangeSet.Builder<C> |
addAll(RangeSet<C> ranges)
Add all ranges from the specified range set to this builder.
|
ImmutableRangeSet<C> |
build()
Returns an
ImmutableRangeSet containing the ranges added to this builder. |
public ImmutableRangeSet.Builder<C> add(Range<C> range)
Add the specified range to this builder. Adjacent/abutting ranges are permitted, but empty ranges, or ranges with nonempty overlap, are forbidden.
IllegalArgumentException
- if range
is empty or has nonempty intersection with any ranges already added to the builderpublic ImmutableRangeSet.Builder<C> addAll(RangeSet<C> ranges)
Add all ranges from the specified range set to this builder. Duplicate or connected ranges are permitted, and will be merged in the resulting immutable range set.
public ImmutableRangeSet<C> build()
Returns an ImmutableRangeSet
containing the ranges added to this builder.