How should Iterator implementation deal with checked exceptions?
问题 I'm wrapping a java.sql.RecordSet inside a java.util.Iterator. My question is, what should I do in case any recordset method throws an SQLException? The java.util.Iterator javadoc explains which exceptions to throw in various situations (i.e. NoSuchElementException in case you call next() beyond the last element) However, it doesn't mention what to do when there is an entirely unrelated problem caused by e.g. network or disk IO problems. Simply throwing SQLException in next() and hasNext() is