diff options
author | Nick Burch <nick@apache.org> | 2008-02-05 15:51:29 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-02-05 15:51:29 +0000 |
commit | 407a62f2bc90b7e635b689ee116845ab22f0dc9e (patch) | |
tree | 08e3c324bc2a64ba2bd61e102e581d127147b2c4 | |
parent | abe75c040f0ad99babcec53c275977d36baf6ec7 (diff) | |
download | poi-407a62f2bc90b7e635b689ee116845ab22f0dc9e.tar.gz poi-407a62f2bc90b7e635b689ee116845ab22f0dc9e.zip |
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
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFRow.java | 8 | ||||
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java index ae5727bc68..c759bcb46b 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java @@ -466,11 +466,17 @@ public class HSSFRow * @return cell iterator of the physically defined cells. Note element 4 may * actually be row cell depending on how many are defined! */ - public Iterator cellIterator() { return new CellIterator(); } + /** + * Alias for {@link CellIterator} to allow + * foreach loops + */ + public Iterator iterator() { + return cellIterator(); + } private class CellIterator implements Iterator { diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index 0250a4cbaa..ee8aeac590 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -701,11 +701,18 @@ public class HSSFSheet * @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. */ - public Iterator rowIterator() { 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 |