diff options
author | Nick Burch <nick@apache.org> | 2008-02-05 15:41:37 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-02-05 15:41:37 +0000 |
commit | ccc4069b86cc14066a11c36371ce6263eed334ff (patch) | |
tree | 727fa300fe1542746db3a5e679ecde0e49e4a34c /src/java/org | |
parent | 7f4e502991d3cf222ed3603b854f18afe74e3eb0 (diff) | |
download | poi-ccc4069b86cc14066a11c36371ce6263eed334ff.tar.gz poi-ccc4069b86cc14066a11c36371ce6263eed334ff.zip |
Have iterating over rows and cells work with JDK 1.5 foreach loops through java.lang.Iterable
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@618676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFRow.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java index ce2bc605fb..3ac5ae3a5b 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java @@ -476,6 +476,13 @@ public class HSSFRow { 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 9fc0091ec4..bb1f5794fd 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -715,11 +715,17 @@ public class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet * @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 |