Class SynchronizedRangeMap<K extends Comparable<? super K>,​V>

  • Type Parameters:
    K - the type of keys in this tree
    V - the type of values in this tree
    All Implemented Interfaces:
    RangeMap<K,​V>

    public final class SynchronizedRangeMap<K extends Comparable<? super K>,​V>
    extends Object
    implements RangeMap<K,​V>
    Adds synchronization around a RangeMap.
    • Method Detail

      • get

        public V get​(K key)
        Description copied from interface: RangeMap
        Returns the value associated with a key.
        Specified by:
        get in interface RangeMap<K extends Comparable<? super K>,​V>
        Parameters:
        key - the key for which to look up a value, not null
        Returns:
        the value associated with key or null if not found
        See Also:
        Map.get(Object)
      • computeIfAbsent

        public V computeIfAbsent​(K key,
                                 Function<? super K,​Map.Entry<Range<? extends K>,​? extends V>> mappingFunction)
        Description copied from interface: RangeMap
        Looks up a value associated with a key. If none is found the mapping function is applied. If the mapping produces a not null value then the mapping is created.
        Specified by:
        computeIfAbsent in interface RangeMap<K extends Comparable<? super K>,​V>
        Parameters:
        key - the key for which to look up a value, not null
        mappingFunction - the mapping function to apply if no value has been found, not null
        Returns:
        the value associated with key or null if not found
        See Also:
        Map.computeIfAbsent(Object, Function), AbstractMap.SimpleImmutableEntry
      • put

        public void put​(K low,
                        K high,
                        V value)
        Description copied from interface: RangeMap
        Associates a range of keys with a value.
        Specified by:
        put in interface RangeMap<K extends Comparable<? super K>,​V>
        Parameters:
        low - the lower end of the range, inclusive, not null
        high - the upper end of the range, inclusive, not null
        value - the value to associate, possibly null
        See Also:
        Map.put(Object, Object)
      • putIfAbsent

        public V putIfAbsent​(K low,
                             K high,
                             V value)
        Description copied from interface: RangeMap
        Associates a range of keys with a value only if no existing mapping exists.
        Specified by:
        putIfAbsent in interface RangeMap<K extends Comparable<? super K>,​V>
        Parameters:
        low - the lower end of the range, inclusive, not null
        high - the upper end of the range, inclusive, not null
        value - the value to associate, possibly null
        Returns:
        the value mapped to the key range before this method was called
        See Also:
        Map.putIfAbsent(Object, Object)