Current Iterator

It's often useful to get an iterator's current value, without forcing it to get its next value. Its current value can be accessed any number of times with getCurrentValue(), or as a Java Object with getCurrent().

To demonstrate, an iterator named iter is created against a collection, as in the next example.

    
    <dm:ints range="[1,10]2">
      <dm:iterator id="iter"/>
    </dm:ints>
     
  

This is run with:

    
    DatamixerContext context = root.getContext ();
    DatamixerIterator iter = context.getDatamixerIterator ("iter");
    while (iter.hasNext ())
    {
	System.out.print (iter.getNextValue () + " "
			  + iter.getCurrentValue () + " ");
    }
    System.out.println ();
    
  

Note that the second call to iter is getCurrentValue(). The result is:

    
    1 1 3 3 5 5 7 7 9 9