Iterator classes in LotusScript

The Iterator is a convenience class to loop through a set of elements. Related to the Enumeration class (Java folks know what I mean :-). The ArrayIterator is used to loop through a LotusScript array, like this:

 Dim a(0 To 4) As String a(0) = "Test 0" a(1) = "Test 1" a(2) = "Test 2" a(3) = "Test 3" a(4) = "Test 4" Dim iterator As New ArrayIterator(a) Do While iterator.hasNext() 	Print Loop 

You have to put the attached code in a script library, and put %INCLUDE ”lserr.lss” in (Options).

Attached is also the EmptyIterator class, that can be used to return an Iterator from a method, which chould not have any elements in it.