Packageorg.as3collections.maps
Classpublic class ReadOnlyHashMap
InheritanceReadOnlyHashMap Inheritance AbstractHashMap Inheritance Object

A HashMap that doesn't allow modifications. It receives all the mappings by its constructor and can no longer be changed. All methods that change the map will throw an UnsupportedOperationError.

View the examples



Public Properties
 PropertyDefined By
 InheritedallKeysEquatable : Boolean
[read-only] Indicates whether all keys in this map implements org.as3coreaddendum.system.IEquatable interface.
AbstractHashMap
 InheritedallValuesEquatable : Boolean
[read-only] Indicates whether all values in this map implements org.as3coreaddendum.system.IEquatable interface.
AbstractHashMap
Public Methods
 MethodDefined By
  
Constructor, creates a new ReadOnlyHashMap object.
ReadOnlyHashMap
  
clear():void
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
clone():*
[override] Creates and return a new ReadOnlyHashMap object containing all mappings in this map.
ReadOnlyHashMap
 Inherited
containsKey(key:*):Boolean
Returns true if this map contains a mapping for the specified key.
AbstractHashMap
 Inherited
containsValue(value:*):Boolean
Returns true if this map maps one or more keys to the specified value.
AbstractHashMap
 Inherited
Returns an ArrayList object that is a view of the mappings contained in this map.
AbstractHashMap
 Inherited
equals(other:*):Boolean
This method uses MapUtil.equalNotConsideringOrder method to perform equality, sending this map and other argument.
AbstractHashMap
 Inherited
Returns an ArrayList object that is a view of the keys contained in this map.
AbstractHashMap
 Inherited
getValue(key:*):*
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
AbstractHashMap
 Inherited
Returns an ArrayList object that is a view of the values contained in this map.
AbstractHashMap
 Inherited
isEmpty():Boolean
Returns true if this map contains no key-value mappings.
AbstractHashMap
  
[override] Returns an iterator over a set of mappings.
ReadOnlyHashMap
  
put(key:*, value:*):*
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
putAll(map:IMap):void
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
putAllByObject(o:Object):void
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
remove(key:*):*
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
removeAll(keys:ICollection):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
  
retainAll(keys:ICollection):Boolean
[override] This implementation always throws an UnsupportedOperationError.
ReadOnlyHashMap
 Inherited
size():int
Returns the number of key-value mappings in this map.
AbstractHashMap
 Inherited
toString():String
Returns the string representation of this instance.
AbstractHashMap
Constructor Detail
ReadOnlyHashMap()Constructor
public function ReadOnlyHashMap(source:IMap)

Constructor, creates a new ReadOnlyHashMap object.

Parameters
source:IMap — an map to fill the list.

Throws
ArgumentError — if the source argument is null.
Method Detail
clear()method
override public function clear():void

This implementation always throws an UnsupportedOperationError.


Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
clone()method 
override public function clone():*

Creates and return a new ReadOnlyHashMap object containing all mappings in this map.

Returns
* — a new ReadOnlyHashMap object containing all mappings in this map.
iterator()method 
override public function iterator():IIterator

Returns an iterator over a set of mappings.

This implementation returns a ReadOnlyMapIterator object.

Returns
IIterator — an iterator over a set of values.

See also

put()method 
override public function put(key:*, value:*):*

This implementation always throws an UnsupportedOperationError.

Parameters

key:*
 
value:*

Returns
*

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
putAll()method 
override public function putAll(map:IMap):void

This implementation always throws an UnsupportedOperationError.

Parameters

map:IMap


Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
putAllByObject()method 
override public function putAllByObject(o:Object):void

This implementation always throws an UnsupportedOperationError.

Parameters

o:Object


Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
putEntry()method 
override public function putEntry(entry:IMapEntry):*

This implementation always throws an UnsupportedOperationError.

Parameters

entry:IMapEntry

Returns
*

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
remove()method 
override public function remove(key:*):*

This implementation always throws an UnsupportedOperationError.

Parameters

key:*

Returns
*

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
removeAll()method 
override public function removeAll(keys:ICollection):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

keys:ICollection

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
retainAll()method 
override public function retainAll(keys:ICollection):Boolean

This implementation always throws an UnsupportedOperationError.

Parameters

keys:ICollection

Returns
Boolean

Throws
org.as3coreaddendum.errors:UnsupportedOperationError ReadOnlyHashMap is a read-only map and doesn't allow modifications.
Examples
     import org.as3collections.IMap;
     import org.as3collections.maps.HashMap;
     import org.as3collections.maps.ReadOnlyHashMap;
     
     var obj:Object = {fa:"fb",ga:"gb",ha:"hb"}
     
     var map1:IMap = new HashMap();
     
     map1.putAllByObject(obj);
     
     map1                  // {ha=hb,ga=gb,fa=fb}
     map1.size()           // 3
     
     var map2:IMap = new ReadOnlyHashMap(map1);
     
     map2                  // {ha=hb,ga=gb,fa=fb}
     map2.size()           // 3
     
     map2.put(1, 2)        // UnsupportedOperationError: ReadOnlyHashMap is a read-only map and doesn't allow modifications.
     
     map2.remove(1)        // UnsupportedOperationError: ReadOnlyHashMap is a read-only map and doesn't allow modifications.