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