public boolean hasNext() { return next != null;
SortedSet sortedAltFields = new TreeSet(comp);  Iterator iter = fields.values().iterator(); while (iter.hasNext()) { Field field = (Field)iter.next(); if (field.hasAltId(altId)) { sortedAltFields.add(field);
  public Iterator altFieldIterator(final String altId)  {    return new Iterator() {      private Iterator iter = fields.values().iterator();      private Field next = findNext();      //{{{ private Field findNext()      private Field findNext() {	while (iter.hasNext()) {	  Field next = (Field)iter.next();	  if (next.hasAltId(altId)) {	    return next;	  }	}	return null;      }      //}}}      //{{{ public boolean hasNext()      public boolean hasNext()      {	return next != null;      }      //}}}      //{{{ public Object next()      public Object next()      {	Field result = next;	next = findNext();	return result;      }      //}}}      //{{{ public void remove()      public void remove()      {	throw new UnsupportedOperationException();      }      //}}}    };  }