Jaa


MapIterator Class

Definition

The MapIterator class is used to iterate over the elements in a map.

public ref class MapIterator : Microsoft::Dynamics::Ax::Xpp::XppObjectBase
public class MapIterator : Microsoft.Dynamics.Ax.Xpp.XppObjectBase
type MapIterator = class
    inherit XppObjectBase
Public Class MapIterator
Inherits XppObjectBase
Inheritance
Microsoft.Dynamics.AX.KernelInterop.ProxyBase
MapIterator

Remarks

Map iterators are used to iterate over the elements in a map. They can be viewed as simple pointers into the maps over which they iterate. Functionality is available to start the iteration, determine whether more (key, value) pairs are available, and fetch the element that is pointed to by the iterator. It is better to use the MapEnumerator class than the MapIterator class. Map iterators and the maps over which they iterate must be on the same client/server side. If you use the MapIterator class and code is marked as Called from, the map and the iterator could end up on different tiers, and the code will fail. If you use the MapEnumerator class, the enumerator is automatically created on the same tier as the map. Additionally, if you use the MapIterator class, you must explicitly call the more and next methods to move to the next item in a map. If you use the MapEnumerator class, you only have to call the moveNext method. The sequence in which the elements are inserted does not determine the order in which they occur. The order is defined by the ordering of the elements. Elements that have lower keys appear before elements that have higher keys. The usual ordering for the types is used. However, if the keys are objects, the addresses of the objects are used to supply the ordering, and therefore no specific ordering can be inferred. The addresses of the objects are transient by nature.

The following example creates a map and adds three (key, value) pairs. It then iterates through the map and prints information about each map element.

{ 
    Map iim = new Map(Types::Integer, Types::Class); 
    MapIterator it; 
    // Add some elements into the map 
    iim.insert(1, new query()); 
    iim.insert(2, new query()); 
    iim.insert(4, new query()); 
    // Create a map iterator 
    it = new MapIterator (iim); 
    // Print "[int -> class] iterator" 
    print it.definitionString();     
    // Go on for as long as elements are found in the map 
    while (it.more()) 
    { 
        // Print each key (1, 2, 4) 
        print it.key();  
        // Print text representation of each value 
        print it.value().toString();  
        // Fetch next element in map 
        it.next(); 
    } 
    pause; 
}

Constructors

MapIterator()
MapIterator(Map)

Fields

kernelClass (Inherited from XppObjectBase)

Properties

AxClassId

Methods

__shouldCallNew(Type) (Inherited from XppObjectBase)
addXppProxyReference(Type, Object) (Inherited from XppObjectBase)
begin()

Moves the iterator to the start of the map.

Call(String, Object[], Type[], Object[]) (Inherited from XppObjectBase)
cancelTimeOut(Int32) (Inherited from XppObjectBase)
createKernelClass(Object[], Type[], Object[]) (Inherited from XppObjectBase)
definitionString()

Retrieves a textual representation of the iterator type, such as "[int -> str] iterator".

delete()

Removes from the map the element that is pointed to by the iterator.

domainValue()

Returns the value of the key in the (key, value) pair that is referred to by the iterator.

end()

Moves the iterator past the last element in the map.

equal(XppObjectBase) (Inherited from XppObjectBase)
finalize() (Inherited from XppObjectBase)
find(Object)

Searches for the specified key value.

GetIntPtr() (Inherited from XppObjectBase)
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getXppProxyReference(Type) (Inherited from XppObjectBase)
handle()
IsManagedValid() (Inherited from XppObjectBase)
kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
key()

Returns the key from the (key, value) pair that is referred to by the iterator.

MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
more()

Determines whether the iterator finds a valid (key, value) pair.

newmethod() (Inherited from XppObjectBase)
next()

Moves the iterator to the next (key, value) pair.

notify() (Inherited from XppObjectBase)
notifyAll() (Inherited from XppObjectBase)
objectOnServer()
Obsolete.
(Inherited from XppObjectBase)
rangeValue()

Returns the value of the value in the (key, value) pair that is referred to by the iterator.

setTimeOut(String, Int32, Boolean)
Obsolete.
(Inherited from XppObjectBase)
setTimeOut(String, Int32)
Obsolete.
(Inherited from XppObjectBase)
ToString()

Retrieves a textual representation of the iterator.

usageCount() (Inherited from XppObjectBase)
value()

Returns the value from the (key, value) pair that is referred to by the iterator.

valuePair()

Retrieves a container that holds the key and the value.

VerifyKernelClass() (Inherited from XppObjectBase)
wait() (Inherited from XppObjectBase)
Xml() (Inherited from XppObjectBase)
Xml(Int32) (Inherited from XppObjectBase)

Applies to