dw.util
Class SortedMap
Object
dw.util.Map
dw.util.SortedMap
A map that further guarantees that it will be in ascending key order, sorted according to the natural ordering of its keys, or by a comparator provided at sorted map creation time. This order is reflected when iterating over the sorted map's collection views (returned by the entrySet, keySet and values methods). Note that sorting by natural order is only supported for Number, String, Date, Money and Quantity as key.
Constructor Summary
SortedMap()
Constructor to create a new SortedMap.
SortedMap(comparator : Object)
Constructor to create a new SortedMap.
Method Summary
clone() : SortedMap
Returns a shallow copy of this map.
firstKey() : Object
Returns the first (lowest) key currently in this sorted map.
headMap(key : Object) : SortedMap
Returns a view of the portion of this map whose keys are strictly less than toKey.
lastKey() : Object
Returns the last (highest) key currently in this sorted map.
subMap(from : Object, to : Object) : SortedMap
Returns a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.
tailMap(key : Object) : SortedMap
Returns a view of the portion of this map whose keys are greater than or equal to fromKey.
Methods inherited from class Map
Methods inherited from class Object
Constructor Detail
SortedMap
public SortedMap()
Constructor to create a new SortedMap.

SortedMap
public SortedMap(comparator : Object)
Constructor to create a new SortedMap. The constructor takes a compare function as additional parameter. This comparator determines identity and the order of the element keys for this map. The order of the elements is determined with a comparator (see PropertyComparator) or with the help of the given function. The function must take two parameters and return a value <=-1 if the first parameter is smaller than the second, a value if >=1 if the first one is greater than the second parameter and a value in between like 0 if both are equal.
Parameters:
comparator - an instance of a PropertyComparator or a comparison function

Method Detail
clone
clone() : SortedMap
Returns a shallow copy of this map.
Returns:
a shallow copy of this map.

firstKey
firstKey() : Object
Returns the first (lowest) key currently in this sorted map.
Returns:
the first (lowest) key currently in this sorted map.

headMap
headMap(key : Object) : SortedMap
Returns a view of the portion of this map whose keys are strictly less than toKey.
Parameters:
key - high endpoint (exclusive) of the headMap.
Returns:
a view of the portion of this map whose keys are strictly less than toKey.

lastKey
lastKey() : Object
Returns the last (highest) key currently in this sorted map.
Returns:
the last (highest) key currently in this sorted map.

subMap
subMap(from : Object, to : Object) : SortedMap
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 sorted map is empty.)
Parameters:
from - low endpoint (inclusive) of the subMap.
to - high endpoint (exclusive) of the subMap.
Returns:
a view of the portion of this map whose keys range from fromKey, inclusive, to toKey, exclusive.

tailMap
tailMap(key : Object) : SortedMap
Returns a view of the portion of this map whose keys are greater than or equal to fromKey. The returned sorted map is backed by this map, so changes in the returned sorted map are reflected in this map, and vice-versa. The returned sorted map supports all optional map operations.
Parameters:
key - low endpoint (inclusive) of the tailMap.
Returns:
a view of the portion of this map whose keys are greater than or equal to fromKey.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. By continuing to use this site you are giving us your consent to do this.