Returns this RangeMap as a map of ranges.
Returns this RangeMap as a map of ranges.
Warning: This differs from Guava which returns an unmodifiable view of this RangeMap which modifications to its range map are guaranteed to read through to the returned map.
It is guaranteed that no empty ranges will be in the returned Map
.
Removes all associations from this range map.
Removes all associations from this range map.
Returns the value associated with the specified key in a Some
, or None
if there is no
such value.
Returns the value associated with the specified key in a Some
, or None
if there is no
such value.
Specifically, if any range in this range map contains the specified key, the value associated with that range is returned.
Returns the range containing this key and its associated value in a Some
, if such a range is present
in the range map, or None
otherwise.
Returns the range containing this key and its associated value in a Some
, if such a range is present
in the range map, or None
otherwise.
Maps a range to a specified value.
Maps a range to a specified value.
Specifically, after a call to put(range, value)
, if
range.contains(k)
, then get(k)
will return value
.
If range
is empty, then this is a no-op.
Removes all associations from this range map in the specified range.
Removes all associations from this range map in the specified range.
If !range.contains(k)
, get(k)
will return the same result
before and after a call to remove(range)
. If range.contains(k)
, then
after a call to remove(range)
, get(k)
will return None
.
Returns the minimal range enclosing the ranges in this RangeMap
in a Some
or None
if this range map is empty
Returns the minimal range enclosing the ranges in this RangeMap
in a Some
or None
if this range map is empty
Returns a view of the part of this range map that intersects with range
.
Returns a view of the part of this range map that intersects with range
.
For example, if rangeMap
had the entries
[1, 5] => "foo", (6, 8) => "bar", (10, ‥) => "baz"
then rangeMap.subRangeMap(Range.open(3, 12))
would return a range map
with the entries (3, 5) => "foo", (6, 8) => "bar", (10, 12) => "baz"
.
The returned range map supports all optional operations that this range map supports.
The returned range map will throw an IllegalArgumentException
on an attempt to
insert a range not enclosed by range
.
Alias for #put(range, value)
Alias for #put(range, value)
Alias for #remove(range)
Alias for #remove(range)
Returns true
if obj
is another RangeMap that has an equivalent
#asMapOfRanges()
.
Returns true
if obj
is another RangeMap that has an equivalent
#asMapOfRanges()
.
Returns asMapOfRanges().hashCode()
.
Returns asMapOfRanges().hashCode()
.
Returns true
if this range map contains no ranges.
Returns true
if this range map contains no ranges.
Puts all the associations from rangeMap
into this range map.
Puts all the associations from rangeMap
into this range map.
Returns a readable string representation of this range map.
Returns a readable string representation of this range map.
A mapping from disjoint nonempty ranges to non-null values. Queries look up the value associated with the range (if any) that contains a specified key.
In contrast to RangeSet, no "coalescing" is done of connected ranges, even if they are mapped to the same value.
Usage example:
0.9