Packageorg.as3collections.utils
Classpublic class MapUtil
InheritanceMapUtil Inheritance Object

A utility class to work with implementations of the IMap interface.



Public Methods
 MethodDefined By
  
MapUtil is a static class and shouldn't be instantiated.
MapUtil
  
equalConsideringOrder(map1:IMap, map2:IMap):Boolean
[static] Performs an arbitrary, specific evaluation of equality between this object and the other object.
MapUtil
  
equalNotConsideringOrder(map1:IMap, map2:IMap):Boolean
[static] Performs an arbitrary, specific evaluation of equality between this object and the other object.
MapUtil
  
feedMapWithXmlList(map:IMap, list:XMLList, typeCoercion:Boolean = true):void
[static] Feeds argument map with argument list.
MapUtil
  
getTypedListMap(wrapMap:IListMap, typeKeys:*, typeValues:*):TypedListMap
[static] Returns a new TypedListMap with the wrapMap argument wrapped.
MapUtil
  
getTypedMap(wrapMap:IMap, typeKeys:*, typeValues:*):TypedMap
[static] Returns a new TypedMap with the wrapMap argument wrapped.
MapUtil
  
getTypedSortedMap(wrapMap:ISortedMap, typeKeys:*, typeValues:*):TypedSortedMap
[static] Returns a new TypedSortedMap with the wrapMap argument wrapped.
MapUtil
  
toString(map:IMap):String
[static] Returns the string representation of the map argument.
MapUtil
Constructor Detail
MapUtil()Constructor
public function MapUtil()

MapUtil is a static class and shouldn't be instantiated.


Throws
IllegalOperationError MapUtil is a static class and shouldn't be instantiated.
Method Detail
equalConsideringOrder()method
public static function equalConsideringOrder(map1:IMap, map2:IMap):Boolean

Performs an arbitrary, specific evaluation of equality between this object and the other object. If one of the maps or both maps are null it will be returned false.

Two different objects are considered equal if:

This implementation takes care of the order of the mappings in the maps. So, for two maps are equal the order of entries returned by the iterator object must be equal.

Parameters

map1:IMap — the first map.
 
map2:IMap — the second map.

Returns
Booleantrue if the arbitrary evaluation considers the objects equal.
equalNotConsideringOrder()method 
public static function equalNotConsideringOrder(map1:IMap, map2:IMap):Boolean

Performs an arbitrary, specific evaluation of equality between this object and the other object. If one of the maps or both maps are null it will be returned false.

Two different objects are considered equal if:

This implementation does not takes care of the order of the mappings in the map.

Parameters

map1:IMap — the first map.
 
map2:IMap — the second map.

Returns
Booleantrue if the arbitrary evaluation considers the objects equal.
feedMapWithXmlList()method 
public static function feedMapWithXmlList(map:IMap, list:XMLList, typeCoercion:Boolean = true):void

Feeds argument map with argument list.

The name of the nodes become keys and the values of the nodes become values of the IMap object.

Parameters

map:IMap — the map to be fed.
 
list:XMLList — the list to retrieve entries.
 
typeCoercion:Boolean (default = true) — if true performs a type coercion to Boolean if some String is "true" or "false", or a type coercion to Number if some String is a Number (i.e. !isNaN(Number(string)) == true).


Example
         import org.as3collections.maps.HashMap;
         import org.as3collections.utils.MapUtil;
         
         var map:IMap = new HashMap();
         var xml:XML = <index><key1>value1</key1><key2>value2</key2></index>;
         
         MapUtil.feedMapFromXmlList(map, xml.children());
         
         trace(map); // [key1=value1,key2=value2]
         
getTypedListMap()method 
public static function getTypedListMap(wrapMap:IListMap, typeKeys:*, typeValues:*):TypedListMap

Returns a new TypedListMap with the wrapMap argument wrapped.

Parameters

wrapMap:IListMap — the target map to be wrapped by the TypedListMap.
 
typeKeys:* — the type of the keys allowed by the returned TypedListMap.
 
typeValues:* — the type of the values allowed by the returned TypedListMap.

Returns
TypedListMap — a new TypedListMap with the wrapMap argument wrapped.

Throws
ArgumentError — if the wrapMap argument is null.
 
ArgumentError — if the typeKeys argument is null.
 
ArgumentError — if the typeValues argument is null.
 
org.as3coreaddendum.errors:ClassCastError — if the types of one or more keys or values in the wrapMap argument are incompatible with the typeKeys or typeValues argument.
getTypedMap()method 
public static function getTypedMap(wrapMap:IMap, typeKeys:*, typeValues:*):TypedMap

Returns a new TypedMap with the wrapMap argument wrapped.

Parameters

wrapMap:IMap — the target map to be wrapped by the TypedMap.
 
typeKeys:* — the type of the keys allowed by the returned TypedMap.
 
typeValues:* — the type of the values allowed by the returned TypedMap.

Returns
TypedMap — a new TypedMap with the wrapMap argument wrapped.

Throws
ArgumentError — if the wrapMap argument is null.
 
ArgumentError — if the typeKeys argument is null.
 
ArgumentError — if the typeValues argument is null.
 
org.as3coreaddendum.errors:ClassCastError — if the types of one or more keys or values in the wrapMap argument are incompatible with the typeKeys or typeValues argument.
getTypedSortedMap()method 
public static function getTypedSortedMap(wrapMap:ISortedMap, typeKeys:*, typeValues:*):TypedSortedMap

Returns a new TypedSortedMap with the wrapMap argument wrapped.

Parameters

wrapMap:ISortedMap — the target map to be wrapped by the TypedSortedMap.
 
typeKeys:* — the type of the keys allowed by the returned TypedSortedMap.
 
typeValues:* — the type of the values allowed by the returned TypedSortedMap.

Returns
TypedSortedMap — a new TypedSortedMap with the wrapMap argument wrapped.

Throws
ArgumentError — if the wrapMap argument is null.
 
ArgumentError — if the typeKeys argument is null.
 
ArgumentError — if the typeValues argument is null.
 
org.as3coreaddendum.errors:ClassCastError — if the types of one or more keys or values in the wrapMap argument are incompatible with the typeKeys or typeValues argument.
toString()method 
public static function toString(map:IMap):String

Returns the string representation of the map argument.

Parameters

map:IMap — the target map.

Returns
String — the string representation of the target map.