code: private void discard(int n) throws JspTagException {
          /*
           * copy index so we can restore it, but we need to update it
           * as we work so that atEnd() works
           */
          int oldIndex = index;
          while (n-- > 0 && !atEnd() && hasNext()) {
              index++;
              next();
          }
          index = oldIndex;
      }
docs: Cycles through and discards up to 'n' items from the iteration.
  We only know "up to 'n'", not "exactly n," since we stop cycling
  if hasNext() returns false or if we hit the 'end' of the iteration.
  Note: this does not update the iteration index, since this method
  is intended as a behind-the-scenes operation.  The index must be
  updated separately.  (I don't really like this, but it's the simplest
  way to support isLast() without storing two separate inconsistent
  indices.  We need to (a) make sure hasNext() refers to the next
  item we actually *want* and (b) make sure the index refers to the
  item associated with the *current* round, not the next one.
  C'est la vie.)