Class RestrictedCollections.RestrictedSortedMap

    • Constructor Detail

      • RestrictedSortedMap

        public RestrictedSortedMap​(Map map,
                                   Class clzKey,
                                   Class clzVal)
        Constructor.
        Parameters:
        map - the underlying SortedMap
        clzKey - the class of keys that may be stored in the Map
        clzVal - the class of values that may be stored in the Map
    • Method Detail

      • comparator

        public Comparator comparator()
        Returns the comparator associated with this sorted map, or null if it uses its keys' natural ordering.
        Specified by:
        comparator in interface SortedMap
        Returns:
        the comparator associated with this sorted map, or null if it uses its keys' natural ordering
      • subMap

        public SortedMap subMap​(Object fromKey,
                                Object toKey)
        Returns a view of the portion of this sorted map whose keys range from fromKey, inclusive, to toKey, exclusive. Obeys the general contract of SortedMap.subMap.
        Specified by:
        subMap in interface SortedMap
        Parameters:
        fromKey - low endpoint (inclusive) of the subMap
        toKey - high endpoint (exclusive) of the subMap
        Returns:
        a view of the specified range within this sorted map
      • headMap

        public SortedMap headMap​(Object toKey)
        Returns a view of the portion of this sorted map whose keys are strictly less than toKey.
        Specified by:
        headMap in interface SortedMap
        Parameters:
        toKey - high endpoint (exclusive) of the subMap
        Returns:
        a view of the specified initial range of this sorted map
      • tailMap

        public SortedMap tailMap​(Object fromKey)
        Returns a view of the portion of this sorted map whose keys are greater than or equal to fromKey.
        Specified by:
        tailMap in interface SortedMap
        Parameters:
        fromKey - low endpoint (inclusive) of the tailMap
        Returns:
        a view of the specified final range of this sorted map
      • firstKey

        public Object firstKey()
        Returns the first (lowest) key currently in this sorted map.
        Specified by:
        firstKey in interface SortedMap
        Returns:
        the first (lowest) key currently in this sorted map
      • lastKey

        public Object lastKey()
        Returns the last (highest) key currently in this sorted map.
        Specified by:
        lastKey in interface SortedMap
        Returns:
        the last (highest) key currently in this sorted map