CollectionClasses and iterating a List

Hey Thomas, can you take a look at this and tell me if this is how you intended for iteration through a List to be done? The objects symbols and childScopes are List objects.

  METHOD PUBLIC VOID addSymbolsDeep(TABLE symbolRecord BIND):
    DEF VAR symbol AS CLASS Symbol NO-UNDO.
    symbols:getNthElement(0).
    DO WHILE symbols:hasNextElement():
      symbol = CAST(symbols:nextElement(), Symbol).
      CREATE symbolRecord.
      ASSIGN
          symbolRecord.symbol = symbol
          symbolRecord.progressType = symbol:getProgressType()
          .
    END.
    childScopes:getNthElement(0).
    DO WHILE childScopes:hasNextElement():
      CAST(childScopes:nextElement(), SymbolScope)
          :addSymbolsDeep(TABLE symbolRecord BY-REFERENCE).
    END.
  END METHOD.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tamhas's picture

Looks right on a quick read.

Looks right on a quick read. Of course, I haven't actually used these in quite a while since my orientation is more toward type-specific set objects these days.