ListIterator.toString Method

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

Syntax

public str toString()

Run On

Called

Return Value

Type: str
A string that contains a description of the current value.

Remarks

If the iterator points to the first element in the list, the string will contain an indication of this, in the form "(begin)[value]" If the iterator does not point to an element (that is, the more() method returns false), the following string returned is: (end). If the iterator points to a value, the string is "[value]", where value is a string representation of the element value.

Examples

The following example prints the following description of the values of the two values in a list:

  1. (begin) [2]

  2. [1]

{ 
    List li = new List(Types::Integer); 
    ListIterator it = new ListIterator(li); 
  
    li.addStart(1); 
    li.addStart(2); // This is now the first value 
  
    it.begin(); 
    print it.toString(); 
    it.next(); 
    print it.toString(); 
    pause; 
}

See Also

ListIterator Class

ListIterator.definitionString Method

ListIterator.value Method