Jaa


ListIterator Class

Definition

The ListIterator class is used to iterate over the elements in a list.

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

Remarks

List iterators can be viewed as pointers into the lists over which they iterate. Functionality is available to start the iteration, determine whether more elements are available, and fetch the element that is pointed to by the iterator. The order in which the elements occur during iteration is defined by the sequence in which the elements are inserted. Elements can be inserted by using the List.addStart, List.addEnd, or ListIterator.insert method. It is better to use the ListEnumerator class than the ListIterator class. List iterators and the maps over which they iterate must be on the same client/server side. If you use the ListIterator class, and code is marked as Called from, it is possible that the list and the iterator will be on different tiers. In this case, the code will fail. If you use the ListEnumerator class, the enumerator is automatically created on the same tier as the list. Additionally, to move to the next item in a list, you must explicitly call the more and next methods if you are using a list iterator. If you use the ListEnumerator class, you only have to call the moveNext method. The only situation where you cannot use a list enumerator is where you need to delete elements from a list. For more information, see the delete method.

The following example creates a list and an iterator to point to it. It then uses various methods on the ListIterator class to print a description of the list, and the items in the list.

{ 
    List il = new List(types::Integer); 
    ListIterator it; 
    // Add some elements into the list. 
    il.addStart(1); 
    il.addStart(2); 
    il.addStart(4);  
    // Create a list iterator to traverse the values. 
    it = new ListIterator (il);  
    // Prints "int list iterator". 
    print it.definitionString();  
    // Prints "(begin)[4]". 
    print it.toString();  
    // Go on for as long as elements are found in the list. 
    // Prints 4, 2, 1. 
    while (it.more()) 
    { 
        print it.value(); 
        it.next(); 
    } 
    // Prints (end). 
    print it.toString(); 
    pause; 
}

Constructors

ListIterator()
ListIterator(List)

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 list.

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

Returns a textual representation of the type of the iterator.

Delete()

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

End()

Moves the iterator past the last element in the list.

equal(XppObjectBase) (Inherited from XppObjectBase)
finalize() (Inherited from XppObjectBase)
GetIntPtr() (Inherited from XppObjectBase)
GetKernelInstanceUniqueId() (Inherited from XppObjectBase)
getTimeOutTimerHandle() (Inherited from XppObjectBase)
getXppProxyReference(Type) (Inherited from XppObjectBase)
handle()
Insert(Object)

Inserts a new value at the position in the list that the iterator currently points to.

IsManagedValid() (Inherited from XppObjectBase)
kernelhandle()
KernelInstanceDisposed() (Inherited from XppObjectBase)
MakeReflectionCall(String, Object[]) (Inherited from XppObjectBase)
More()

Determines whether the list iterator points to a valid element.

newmethod() (Inherited from XppObjectBase)
newmethod(List)

Creates a new iterator for a particular list.

Next()

Moves the iterator to the next element in the list.

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

Returns a textual representation of the current list value that is pointed to by the iterator.

usageCount() (Inherited from XppObjectBase)
Value()

Retrieves the value that is pointed to by the iterator.

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

Applies to