Add java.lang.Iterable style methods for iterating over rows and cells, but don't actually implement that, as it wasn't in jdk 1.3 or jdk 1.4, with is rather tedious

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@618680 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-02-05 15:51:29 +00:00
parent 62f71f4958
commit 7377714861
2 changed files with 15 additions and 2 deletions

View File

@ -466,11 +466,17 @@ public class HSSFRow
* @return cell iterator of the physically defined cells. Note element 4 may * @return cell iterator of the physically defined cells. Note element 4 may
* actually be row cell depending on how many are defined! * actually be row cell depending on how many are defined!
*/ */
public Iterator cellIterator() public Iterator cellIterator()
{ {
return new CellIterator(); return new CellIterator();
} }
/**
* Alias for {@link CellIterator} to allow
* foreach loops
*/
public Iterator iterator() {
return cellIterator();
}
private class CellIterator implements Iterator private class CellIterator implements Iterator
{ {

View File

@ -701,11 +701,18 @@ public class HSSFSheet
* @return an iterator of the PHYSICAL rows. Meaning the 3rd element may not * @return an iterator of the PHYSICAL rows. Meaning the 3rd element may not
* be the third row if say for instance the second row is undefined. * be the third row if say for instance the second row is undefined.
*/ */
public Iterator rowIterator() public Iterator rowIterator()
{ {
return rows.values().iterator(); return rows.values().iterator();
} }
/**
* Alias for {@link #rowIterator()} to allow
* foreach loops
*/
public Iterator iterator() {
return rowIterator();
}
/** /**
* used internally in the API to get the low level Sheet record represented by this * used internally in the API to get the low level Sheet record represented by this