An Array Iterator

public class ArrayIterator implements Iterator
{
  public ArrayIterator(Object[] array) {
    array_ = array;
    index_ = 0;
  }

  public boolean hasNext() {
    return index_ != array.length;
  }

  public Object next() {
    if(!hasNext())
      throw new NoSuchElementException();
    return array[index_++];
  }

  public void remove() { ... }

  private Object[] array_;
  private int index_;
}
Here's an iterator wrapper around an array, and it's exactly as you'd expect.

Subsequent changes to the framework meant that extra things were added to the parameter map. There reasoning was sound (transparent session caching, testing, disconnected modes and so on), even if the implementation was not as it might be. Initially, these were single object. Just single objects, not arrays - because arrays are a faff. Then somebody added a List - because arrays were a faff.

So now the map has values which might be null, might be an object, could be a string array, or it could be a list. Ouch. But it doesn't matter, because the code here is dealing in iterators.