Top Description Inners Fields Constructors Methods
com.google.common.collect

public final Class TreeRangeMap<K extends Comparable<T>, V>

extends Object
implements RangeMap<K extends Comparable<T>, V>
Class Inheritance
All Implemented Interfaces
com.google.common.collect.RangeMap
Annotations
@SuppressWarnings:rawtypes
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Static Imports
com.google.common.base.Preconditions.checkArgument, .Preconditions.checkNotNull, .Predicates.compose, .Predicates.in, .Predicates.not, java.util.Objects.requireNonNull

An implementation of RangeMap based on a TreeMap, supporting all optional operations.

Like all RangeMap implementations, this supports neither null keys nor null values.

Author
Louis Wasserman
Since
14.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
private class

Field Summary

Modifier and TypeField and Description
private static final RangeMap<Comparable<?>, Object>
private final NavigableMap<Cut<K>, TreeRangeMap.RangeMapEntry<K, V>>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Map<Range<K>, V>
asDescendingMapOfRanges()

Implements com.google.common.collect.RangeMap.asDescendingMapOfRanges.

Returns a view of this range map as an unmodifiable Map<Range<K>, V>.
public Map<Range<K>, V>
asMapOfRanges()

Implements com.google.common.collect.RangeMap.asMapOfRanges.

Returns a view of this range map as an unmodifiable Map<Range<K>, V>.
public void
clear()

Implements com.google.common.collect.RangeMap.clear.

Removes all associations from this range map (optional operation).
private static <K extends Comparable<T>, V> Range<K>
coalesce(Range<K> range, V value, Map.Entry<Cut<K>, TreeRangeMap.RangeMapEntry<K, V>> entry)

Returns the range that spans the given range and entry, if the entry can be coalesced.

private Range<K>
coalescedRange(Range<K> range, V value)

Computes the coalesced range for the given range+value - does not mutate the map.

public static <K extends Comparable<T>, V> TreeRangeMap<K, V>
private RangeMap<K, V>
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Implements com.google.common.collect.RangeMap.equals.

Returns true if obj is another RangeMap that has an equivalent asMapOfRanges().
public V
get(K key)

Implements com.google.common.collect.RangeMap.get.

Returns the value associated with the specified key, or null if there is no such value.
public Map.Entry<Range<K>, V>
getEntry(K key)

Implements com.google.common.collect.RangeMap.getEntry.

Returns the range containing this key and its associated value, if such a range is present in the range map, or null otherwise.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements com.google.common.collect.RangeMap.hashCode.

Returns asMapOfRanges().hashCode().
public void
merge(Range<K> range, V value, BiFunction<? super V, ? super @Nullable V, ? extends @Nullable V> remappingFunction)

Implements com.google.common.collect.RangeMap.merge.

Merges a value into a part of the map by applying a remapping function.
public void
put(Range<K> range, V value)

Implements com.google.common.collect.RangeMap.put.

Maps a range to a specified value (optional operation).
public void
putAll(RangeMap<K, ? extends V> rangeMap)

Implements com.google.common.collect.RangeMap.putAll.

Puts all the associations from rangeMap into this range map (optional operation).
public void
putCoalescing(Range<K> range, V value)

Implements com.google.common.collect.RangeMap.putCoalescing.

Maps a range to a specified value, coalescing this range with any existing ranges with the same value that are connected to this range.
private void
putRangeMapEntry(Cut<K> lowerBound, Cut<K> upperBound, V value)

public void
remove(Range<K> rangeToRemove)

Implements com.google.common.collect.RangeMap.remove.

Removes all associations from this range map in the specified range (optional operation).
public Range<K>
span()

Implements com.google.common.collect.RangeMap.span.

Returns the minimal range enclosing the ranges in this RangeMap.
private void
split(Cut<K> cut)

public RangeMap<K, V>
subRangeMap(Range<K> subRange)

Implements com.google.common.collect.RangeMap.subRangeMap.

Returns a view of the part of this range map that intersects with range.
public String
toString()

Overrides java.lang.Object.toString.

Implements com.google.common.collect.RangeMap.toString.

Returns a readable string representation of this range map.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait