Packageorg.as3collections
Interfacepublic interface IListMap extends IMap, IIterable, org.as3coreaddendum.system.ICloneable, org.as3coreaddendum.system.IEquatable
Implementors AbstractListMap, TypedListMap

An ordered map. The user of this interface has precise control over where in the map each mapping is inserted. The user can access mappings by their integer index (position in the map), and search for mappings in the map.

The IListMap interface provides the special IListMapIterator iterator, that allows mapping insertion and replacement, and bidirectional access in addition to the normal operations that the IIterator interface provides. The listMapIterator() method is provided to obtain a IListMapIterator implementation that may start at a specified position in the map.

This interface has the purpose to, in certain degree, unify IList and IMap interfaces.

The methods that modify the map are specified to throw org.as3coreaddendum.errors.UnsupportedOperationError if the map does not support the operation. These methods are documented as "optional operation".

See also

AbstractListMap
IMap
ISortedMap
IListMapIterator


Public Properties
 PropertyDefined By
 InheritedallKeysEquatable : Boolean
[read-only] Indicates whether all keys in this map implements org.as3coreaddendum.system.IEquatable interface.
IMap
 InheritedallValuesEquatable : Boolean
[read-only] Indicates whether all values in this map implements org.as3coreaddendum.system.IEquatable interface.
IMap
  modCount : int
[read-only] The number of times this map has been structurally modified.
IListMap
Public Methods
 MethodDefined By
 Inherited
clear():void
Removes all of the mappings from this map (optional operation).
IMap
 Inherited
containsKey(key:*):Boolean
Returns true if this map contains a mapping for the specified key.
IMap
 Inherited
containsValue(value:*):Boolean
Returns true if this map maps one or more keys to the specified value.
IMap
 Inherited
Returns an ICollection object that is a view of the mappings contained in this map.
IMap
  
getKeyAt(index:int):*
Returns the key at the specified position in this map.
IListMap
 Inherited
Returns an ICollection object that is a view of the keys contained in this map.
IMap
 Inherited
getValue(key:*):*
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
IMap
  
getValueAt(index:int):*
Returns the value at the specified position in this map.
IListMap
 Inherited
Returns an ICollection object that is a view of the values contained in this map.
IMap
  
headMap(toKey:*):IListMap
Returns a new IListMap object that is a view of the portion of this map whose keys are strictly less than toKey.
IListMap
  
indexOfKey(key:*):int
Returns the index of the first occurrence of the specified key in this map, or -1 if this map does not contain the key.
IListMap
  
indexOfValue(value:*):int
Returns the index of the first occurrence of the specified value in this map, or -1 if this map does not contain the value.
IListMap
 Inherited
isEmpty():Boolean
Returns true if this map contains no key-value mappings.
IMap
 Inherited
Returns an iterator over a set of elements.
IIterable
  
Returns a IListMapIterator object to iterate over the mappings in this map (in proper sequence), starting at the specified position in this map.
IListMap
 Inherited
put(key:*, value:*):*
Associates the specified value with the specified key in this map (optional operation).
IMap
 Inherited
putAll(map:IMap):void
Copies all of the mappings from the specified map to this map (optional operation).
IMap
  
putAllAt(index:int, map:IMap):void
Copies all of the mappings from the specified map to this map (optional operation).
IListMap
 Inherited
putAllByObject(o:Object):void
Retrieves each property of the specified object, calling put on this map once for each property (optional operation).
IMap
  
putAt(index:int, key:*, value:*):void
Associates the specified value with the specified key at the specified position in this map (optional operation).
IListMap
 Inherited
Associates the specified entry.value with the specified entry.key in this map (optional operation).
IMap
 Inherited
remove(key:*):*
Removes the mapping for a key from this map if it is present (optional operation).
IMap
 Inherited
removeAll(keys:ICollection):Boolean
Removes the mapping for a key from this map (if it is present) for each element in the specified collection (optional operation).
IMap
  
removeAt(index:int):IMapEntry
Removes the mapping at the specified position in this map (optional operation).
IListMap
  
removeRange(fromIndex:int, toIndex:int):IListMap
Removes all of the mappings whose index is between fromIndex, inclusive, and toIndex, exclusive (optional operation).
IListMap
 Inherited
retainAll(keys:ICollection):Boolean
Retains only the mappings in this map that the keys are contained (as elements) in the specified collection (optional operation).
IMap
  
reverse():void
Reverses the order of the mappings in this map.
IListMap
  
setKeyAt(index:int, key:*):*
Replaces the key at the specified position in this map with the specified key (optional operation).
IListMap
  
setValueAt(index:int, value:*):*
Replaces the value at the specified position in this map with the specified value (optional operation).
IListMap
 Inherited
size():int
Returns the number of key-value mappings in this map.
IMap
  
subMap(fromIndex:int, toIndex:int):IListMap
Returns a new IListMap object that is a view of the portion of this map between the specified fromIndex, inclusive, and toIndex, exclusive.
IListMap
  
tailMap(fromKey:*):IListMap
Returns a new IListMap object that is a view of the portion of this map whose keys are greater than or equal to fromKey.
IListMap
Property Detail
modCountproperty
modCount:int  [read-only]

The number of times this map has been structurally modified. Structural modifications are those that change the size of the map.

This field is used by the IListMapIterator implementation returned by the listMapIterator method. If the value of this field changes unexpectedly, the IListMapIterator object will throw a org.as3collections.errors.ConcurrentModificationError in response to the next, remove, previous or put operations.

Implementations merely has to increment this field in its put, remove and any other methods that result in structural modifications to the map. A single call to put or remove must add no more than one to this field.


Implementation
    public function get modCount():int
Method Detail
getKeyAt()method
public function getKeyAt(index:int):*

Returns the key at the specified position in this map.

Parameters

index:int — index of the key to return.

Returns
* — the key at the specified position in this map.

Throws
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
getValueAt()method 
public function getValueAt(index:int):*

Returns the value at the specified position in this map.

Parameters

index:int — index of the value to return.

Returns
* — the value at the specified position in this map.

Throws
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
headMap()method 
public function headMap(toKey:*):IListMap

Returns a new IListMap object that is a view of the portion of this map whose keys are strictly less than toKey. The returned map supports all optional map operations that this map supports.

Parameters

toKey:* — high endpoint (exclusive) of the keys in the returned map.

Returns
IListMap — a new IListMap that is a view of the portion of this map whose keys are strictly less than toKey.

Throws
ArgumentError — if toKey is null and this map does not permit null keys.
 
ArgumentError — if containsKey(toKey) returns false.
indexOfKey()method 
public function indexOfKey(key:*):int

Returns the index of the first occurrence of the specified key in this map, or -1 if this map does not contain the key.

Parameters

key:* — the key to search for.

Returns
int — the index of the first occurrence of the specified key in this map, or -1 if this map does not contain the key.

Throws
org.as3coreaddendum.errors:ClassCastError — if the class of the specified key is incompatible with this map (optional).
 
ArgumentError — if the specified key is null and this map does not permit null keys (optional).
indexOfValue()method 
public function indexOfValue(value:*):int

Returns the index of the first occurrence of the specified value in this map, or -1 if this map does not contain the value.

Parameters

value:* — the value to search for.

Returns
int — the index of the first occurrence of the specified value in this map, or -1 if this map does not contain the value.

Throws
org.as3coreaddendum.errors:ClassCastError — if the class of the specified value is incompatible with this map (optional).
 
ArgumentError — if the specified value is null and this map does not permit null values (optional).
listMapIterator()method 
public function listMapIterator(index:int = 0):IListMapIterator

Returns a IListMapIterator object to iterate over the mappings in this map (in proper sequence), starting at the specified position in this map. The specified index indicates the first value that would be returned by an initial call to next. An initial call to previous would return the value with the specified index minus one.

Parameters

index:int (default = 0) — index of first value to be returned from the iterator (by a call to the next method)

Returns
IListMapIterator — a IListMapIterator object to iterate over the mappings in this map (in proper sequence), starting at the specified position in this map.
putAllAt()method 
public function putAllAt(index:int, map:IMap):void

Copies all of the mappings from the specified map to this map (optional operation). Shifts the entry currently at that position (if any) and any subsequent entries to the right (increases their indices). The new entries will appear in this map in the order that they are returned by the specified map's iterator.

Parameters

index:int — index at which to insert the first entry from the specified map.
 
map:IMap — mappings to be stored in this map.


Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the putAllAt operation is not supported by this map.
 
org.as3coreaddendum.errors:ClassCastError — if the type of a key or value in the specified map is incompatible with this map.
 
ArgumentError — if the specified map is null, or if this map does not permit null keys or values, and the specified map contains null keys or values.
 
ArgumentError — if the specified map contains one or more keys already added in this map.
putAt()method 
public function putAt(index:int, key:*, value:*):void

Associates the specified value with the specified key at the specified position in this map (optional operation). Shifts the entry currently at that position (if any) and any subsequent entries to the right (adds one to their indices).

Parameters

index:int — index at which the specified entry is to be inserted.
 
key:* — key with which the specified value is to be associated.
 
value:* — value to be associated with the specified key.


Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the putAt operation is not supported by this map.
 
org.as3coreaddendum.errors:ClassCastError — if the type of the specified key or value is incompatible with this map.
 
ArgumentError — if the specified key or value is null and this map does not permit null keys or values.
 
ArgumentError — if this map already contains the specified key.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index > size()).
removeAt()method 
public function removeAt(index:int):IMapEntry

Removes the mapping at the specified position in this map (optional operation). Shifts any subsequent mappings to the left (subtracts one from their indices). Returns an IMapEntry object containing the mapping (key/value) that was removed from the map.

Parameters

index:int — the index of the mapping to be removed.

Returns
IMapEntry — an IMapEntry object containing the mapping (key/value) that was removed from the map.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the removeAt operation is not supported by this map.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
removeRange()method 
public function removeRange(fromIndex:int, toIndex:int):IListMap

Removes all of the mappings whose index is between fromIndex, inclusive, and toIndex, exclusive (optional operation). Shifts any subsequent mappings to the left (subtracts their indices).

If toIndex == fromIndex, this operation has no effect.

Parameters

fromIndex:int — the index to start removing mappings (inclusive).
 
toIndex:int — the index to stop removing mappings (exclusive).

Returns
IListMap — a new map containing all the removed mappings.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the removeRange operation is not supported by this map.
 
IndexOutOfBoundsError — if fromIndex or toIndex is out of range (index < 0 || index > size()).
reverse()method 
public function reverse():void

Reverses the order of the mappings in this map.

setKeyAt()method 
public function setKeyAt(index:int, key:*):*

Replaces the key at the specified position in this map with the specified key (optional operation).

Parameters

index:int — index of the key to replace.
 
key:* — key to be stored at the specified position.

Returns
* — the key previously at the specified position.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the setKeyAt operation is not supported by this map.
 
org.as3coreaddendum.errors:ClassCastError — if the class of the specified key prevents it from being added to this map.
 
ArgumentError — if the specified key is null and this map does not permit null keys.
 
ArgumentError — if this map already contains the specified key.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
setValueAt()method 
public function setValueAt(index:int, value:*):*

Replaces the value at the specified position in this map with the specified value (optional operation).

Parameters

index:int — index of the value to replace.
 
value:* — value to be stored at the specified position.

Returns
* — the value previously at the specified position.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the setValueAt operation is not supported by this map.
 
org.as3coreaddendum.errors:ClassCastError — if the class of the specified value prevents it from being added to this map.
 
ArgumentError — if the specified value is null and this map does not permit null values.
 
IndexOutOfBoundsError — if the index is out of range (index < 0 || index >= size()).
subMap()method 
public function subMap(fromIndex:int, toIndex:int):IListMap

Returns a new IListMap object that is a view of the portion of this map between the specified fromIndex, inclusive, and toIndex, exclusive.

The returned map supports all of the optional map operations supported by this map.

Parameters

fromIndex:int — the index to start retrieving mappings (inclusive).
 
toIndex:int — the index to stop retrieving mappings (exclusive).

Returns
IListMap — a new map that is a view of the specified range within this map.

Throws
org.as3coreaddendum.errors:UnsupportedOperationError — if the subMap operation is not supported by this map.
 
IndexOutOfBoundsError — if fromIndex or toIndex is out of range (index < 0 || index > size()).
tailMap()method 
public function tailMap(fromKey:*):IListMap

Returns a new IListMap object that is a view of the portion of this map whose keys are greater than or equal to fromKey. The returned map supports all optional map operations that this map supports.

Parameters

fromKey:* — low endpoint (inclusive) of the keys in the returned map.

Returns
IListMap — a new map that is a view of the portion of this map whose keys are greater than or equal to fromKey.

Throws
ArgumentError — if fromKey is null and this map does not permit null keys.
 
ArgumentError — if containsKey(fromKey) returns false.