Interface ReadOnlyNavigableMap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map
    V - the type of mapped values
    All Superinterfaces:
    ReadOnlyMap<K,​V>, ReadOnlySequencedMap<K,​V>, ReadOnlySortedMap<K,​V>
    All Known Implementing Classes:
    ReadOnlyTreeMap

    public interface ReadOnlyNavigableMap<K,​V>
    extends ReadOnlySortedMap<K,​V>
    This interface was originally copied from GitHub's Open-JDK Account. Though the original file has been modified, few changes have been applied to the Javadoc Commenting. Due to fact that that is a Java interface file, there were few method bodies with Source-Code to begin with - meaning this is largely a copy of Method-Signatures and Java-Doc Comments.

    Method and parameter names & types have not been modified whatsoever; but several methods had to be eliminated for not being Read-Only. This Source-File was copied from the original Open JDK-21 file of the same (or, rather, highly similar) Interface-Name. The original file may be viewed on the JDK-21 GitHub public (and, coincidentally, Read-Only) Source-Release archive for Java Package java.util.*

    The Original '.java' Source-File's Header-Copyright Information is included here: File Copyright. Within that Copyright Notice, it is suggested that a copy of the GNU Public License V2 also be included alongside.
    Immutable variant of Java Collectionds Framework interface java.util.NavigableMap<K, V>. This interface contains all of the methods that the standard Java interface ReadOnlyNavigableMap contains - except those which would directly or indirectly modify / mutate the internal data-structure.


    • Method Detail

      • lowerEntry

        🡇     🗕  🗗  🗖
        ReadOnlyMap.Entry<K,​VlowerEntry​(K key)
        Returns a key-value mapping associated with the greatest key strictly less than the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        an entry with the greatest key less than key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • lowerKey

        🡅  🡇     🗕  🗗  🗖
        K lowerKey​(K key)
        Returns the greatest key strictly less than the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        the greatest key less than key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • floorEntry

        🡅  🡇     🗕  🗗  🗖
        ReadOnlyMap.Entry<K,​VfloorEntry​(K key)
        Returns a key-value mapping associated with the greatest key less than or equal to the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        an entry with the greatest key less than or equal to key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • floorKey

        🡅  🡇     🗕  🗗  🗖
        K floorKey​(K key)
        Returns the greatest key less than or equal to the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        the greatest key less than or equal to key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • ceilingEntry

        🡅  🡇     🗕  🗗  🗖
        ReadOnlyMap.Entry<K,​VceilingEntry​(K key)
        Returns a key-value mapping associated with the least key greater than or equal to the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        an entry with the least key greater than or equal to key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • ceilingKey

        🡅  🡇     🗕  🗗  🗖
        K ceilingKey​(K key)
        Returns the least key greater than or equal to the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        the least key greater than or equal to key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • higherEntry

        🡅  🡇     🗕  🗗  🗖
        ReadOnlyMap.Entry<K,​VhigherEntry​(K key)
        Returns a key-value mapping associated with the least key strictly greater than the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        an entry with the least key greater than key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • higherKey

        🡅  🡇     🗕  🗗  🗖
        K higherKey​(K key)
        Returns the least key strictly greater than the given key, or null if there is no such key.
        Parameters:
        key - the key
        Returns:
        the least key greater than key, or null if there is no such key
        Throws:
        java.lang.ClassCastException - if the specified key cannot be compared with the keys currently in the map
        java.lang.NullPointerException - if the specified key is null and this map does not permit null keys
      • subMap

        🡅  🡇     🗕  🗗  🗖
        ReadOnlyNavigableMap<K,​VsubMap​(K fromKey,
                                               boolean fromInclusive,
                                               K toKey,
                                               boolean toInclusive)
        Returns a view of the portion of this map whose keys range from fromKey to toKey. If fromKey and toKey are equal, the returned map is empty unless fromInclusive and toInclusive are both true.

        The returned map supports all optional map operations that this map supports.
        Parameters:
        fromKey - low endpoint of the keys in the returned map
        fromInclusive - TRUE if the low endpoint is to be included in the returned view
        toKey - high endpoint of the keys in the returned map
        toInclusive - TRUE if the high endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys range from fromKey to toKey
        Throws:
        java.lang.ClassCastException - if fromKey and toKey cannot be compared to one another using this map's comparator (or, if the map has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception if fromKey or toKey cannot be compared to keys currently in the map.
        java.lang.NullPointerException - if fromKey or toKey is null and this map does not permit null keys
        java.lang.IllegalArgumentException - if fromKey is greater than toKey; or if this map itself has a restricted range, and fromKey or toKey lies outside the bounds of the range
      • headMap

        🡅  🡇     🗕  🗗  🗖
        ReadOnlyNavigableMap<K,​VheadMap​(K toKey,
                                                boolean inclusive)
        Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey. The returned map supports all optional map operations that this map supports.
        Parameters:
        toKey - high endpoint of the keys in the returned map
        inclusive - TRUE if the high endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey
        Throws:
        java.lang.ClassCastException - if toKey is not compatible with this map's comparator (or, if the map has no comparator, if toKey does not implement Comparable). Implementations may, but are not required to, throw this exception if toKey cannot be compared to keys currently in the map.
        java.lang.NullPointerException - if toKey is null and this map does not permit null keys
        java.lang.IllegalArgumentException - if this map itself has a restricted range, and toKey lies outside the bounds of the range
      • tailMap

        🡅  🡇     🗕  🗗  🗖
        ReadOnlyNavigableMap<K,​VtailMap​(K fromKey,
                                                boolean inclusive)
        Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey. The returned map supports all optional map operations that this map supports.
        Parameters:
        fromKey - low endpoint of the keys in the returned map
        inclusive - TRUE if the low endpoint is to be included in the returned view
        Returns:
        a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey
        Throws:
        java.lang.ClassCastException - if fromKey is not compatible with this map's comparator (or, if the map has no comparator, if fromKey does not implement Comparable). Implementations may, but are not required to, throw this exception if fromKey cannot be compared to keys currently in the map.
        java.lang.NullPointerException - if fromKey is null and this map does not permit null keys
        java.lang.IllegalArgumentException - if this map itself has a restricted range, and fromKey lies outside the bounds of the range
      • subMap

        🡅  🡇     🗕  🗗  🗖
        ReadOnlySortedMap<K,​VsubMap​(K fromKey,
                                            K toKey)
        Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive. (If fromKey and toKey are equal, the returned map is empty.) The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Equivalent to subMap(fromKey, true, toKey, false).
        Specified by:
        subMap in interface ReadOnlySortedMap<K,​V>
        Parameters:
        fromKey - low endpoint (inclusive) of the keys in the returned map
        toKey - high endpoint (exclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive
        Throws:
        java.lang.ClassCastException - if fromKey and toKey cannot be compared to one another using this map's comparator (or, if the map has no comparator, using natural ordering). Implementations may, but are not required to, throw this exception if fromKey or toKey cannot be compared to keys currently in the map.
        java.lang.NullPointerException - if fromKey or toKey is null and this map does not permit null keys
        java.lang.IllegalArgumentException - if fromKey is greater than toKey; or if this map itself has a restricted range, and fromKey or toKey lies outside the bounds of the range
      • headMap

        🡅  🡇     🗕  🗗  🗖
        ReadOnlySortedMap<K,​VheadMap​(K toKey)
        Returns a view of the portion of this map whose keys are strictly less than toKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Equivalent to headMap(toKey, false).
        Specified by:
        headMap in interface ReadOnlySortedMap<K,​V>
        Parameters:
        toKey - high endpoint (exclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys are strictly less than toKey
        Throws:
        java.lang.ClassCastException - if toKey is not compatible with this map's comparator (or, if the map has no comparator, if toKey does not implement Comparable). Implementations may, but are not required to, throw this exception if toKey cannot be compared to keys currently in the map.
        java.lang.NullPointerException - if toKey is null and this map does not permit null keys
        java.lang.IllegalArgumentException - if this map itself has a restricted range, and toKey lies outside the bounds of the range
      • tailMap

        🡅  🡇     🗕  🗗  🗖
        ReadOnlySortedMap<K,​VtailMap​(K fromKey)
        Returns a view of the portion of this map whose keys are greater than or equal to fromKey. The returned map is backed by this map, so changes in the returned map are reflected in this map, and vice-versa. The returned map supports all optional map operations that this map supports.

        The returned map will throw an IllegalArgumentException on an attempt to insert a key outside its range.

        Equivalent to tailMap(fromKey, true).
        Specified by:
        tailMap in interface ReadOnlySortedMap<K,​V>
        Parameters:
        fromKey - low endpoint (inclusive) of the keys in the returned map
        Returns:
        a view of the portion of this map whose keys are greater than or equal to fromKey
        Throws:
        java.lang.ClassCastException - if fromKey is not compatible with this map's comparator (or, if the map has no comparator, if fromKey does not implement Comparable). Implementations may, but are not required to, throw this exception if fromKey cannot be compared to keys currently in the map.
        java.lang.NullPointerException - if fromKey is null and this map does not permit null keys
        java.lang.IllegalArgumentException - if this map itself has a restricted range, and fromKey lies outside the bounds of the range
      • reversed

        🡅     🗕  🗗  🗖
        default ReadOnlyNavigableMap<K,​Vreversed()
        Returns a reverse-ordered view of this map. The encounter order of mappings in the returned view is the inverse of the encounter order of mappings in this map. The reverse ordering affects all order-sensitive operations, including those on the view collections of the returned view.

        This method is equivalent to descendingMap.
        Specified by:
        reversed in interface ReadOnlySequencedMap<K,​V>
        Specified by:
        reversed in interface ReadOnlySortedMap<K,​V>
        Returns:
        a reverse-ordered view of this map, as a NavigableMap
        Code:
        Exact Method Body:
         return this.descendingMap();