Code example for NoSuchElementException

0
  /** 
   * @throws NoSuchElementException 
   */ 
  public Builder next() { 
    if (!hasNext()) { 
      throw new NoSuchElementException();
    } 
 
    previous = next;
    next = next.getPayloadBuilder();
 
    return previous;
  } 
 
  /** 
   * @throws UnsupportedOperationException 
   */ 
  public void remove() { 
    throw new UnsupportedOperationException();
  }