Class calitha.collections.ISortedMap
Extends
calitha.collections.IMap.
A Map that further provides a total ordering on its keys.
It is based on the Java SortedMap interface. Differences are:
- In Java it is the NavigableMap interface that has methods with extra inclusive parameters for subMap and such. Those methods have been put in this ISortedMap class to replace those same methods without the inclusive parameters. This is done because overloading methods with inheritance too would be too confusing. And the methods with inclusive parameters are more clear anyway.
Defined in: ISortedMap.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.
|
|
firstKey()
Returns the first (lowest) key currently in this map.
|
|
headMap(toKey, inclusive)
Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey.
|
|
lastKey()
Returns the last (highest) key currently in this map.
|
|
subMap(fromKey, fromInclusive, toKey, toInclusive)
Returns a view of the portion of this map whose keys range from fromKey to toKey.
|
|
tailMap(fromKey, inclusive)
Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey.
|
- Methods borrowed from class calitha.collections.IMap:
- clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
Method Detail
{calitha.collections.IComparator}
comparator()
Returns the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys.
- Returns:
- {calitha.collections.IComparator} the comparator used to order the keys in this map, or null if this map uses the natural ordering of its keys
{Object}
firstKey()
Returns the first (lowest) key currently in this map.
- Returns:
- {Object} the first (lowest) key currently in this map
{calitha.collections.ISortedMap}
headMap(toKey, inclusive)
Returns a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey.
- Parameters:
- {Object} toKey
- high endpoint of the keys in the returned map
- {Boolean} inclusive
- true if the high endpoint is to be included in the returned view
- Returns:
- {calitha.collections.ISortedMap} a view of the portion of this map whose keys are less than (or equal to, if inclusive is true) toKey
{Object}
lastKey()
Returns the last (highest) key currently in this map.
- Returns:
- {Object} the last (highest) key currently in this map
{calitha.collections.ISortedMap}
subMap(fromKey, fromInclusive, toKey, toInclusive)
Returns a view of the portion of this map whose keys range from fromKey to toKey.
- Parameters:
- {Object} fromKey
- low endpoint (inclusive) of the keys in the returned map
- {Boolean} fromInclusive
- true if the low endpoint is to be included in the returned view
- {Object} toKey
- high endpoint of the keys in the returned map
- {Boolean} toInclusive
- true if the high endpoint is to be included in the returned view
- Returns:
- {calitha.collections.ISortedMap} a view of the portion of this map whose keys range from fromKey to toKey
{calitha.collections.ISortedMap}
tailMap(fromKey, inclusive)
Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey.
- Parameters:
- {Object} fromKey
- low endpoint of the keys in the returned map
- {Boolean} inclusive
- true if the low endpoint is to be included in the returned view
- Returns:
- {calitha.collections.ISortedMap} a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey