code: public Iterator<T> iterator() {
          return new Iterator<T>() {
              private int currentPosition = start;
              private boolean hasNext = true;
  
              public boolean hasNext() {
                  return hasNext;
              }
  
              @SuppressWarnings("unchecked")
              public T next() {
                  if (end == -1)
                      hasNext = !sequence.getItem(currentPosition).getClass().equals(SequenceTerminal.class);
                  else
                      hasNext = currentPosition < getEnd() - 1;
                  return (T) sequence.getItem(currentPosition++);
              }
  
              public void remove() {
                  throw new UnsupportedOperationException(
                      "The remove method is not supported.");
              }
          };
      }
docs: Retrieves an iterator that steps over the items in this edge.
  
  @return An iterator that walks this edge up to the end or terminating
  node.