aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2010-01-13 13:46:36 +0000
committerNick Burch <nick@apache.org>2010-01-13 13:46:36 +0000
commitb9621dfb147c233ac8779c9727c676641f0e561b (patch)
treeb55e04240b6768e2963549fd5f44329f8a9ef2a2 /src
parent0779f79cc78f7705385ac53d2e725614f1797436 (diff)
downloadpoi-b9621dfb147c233ac8779c9727c676641f0e561b.tar.gz
poi-b9621dfb147c233ac8779c9727c676641f0e561b.zip
Tweak the iterator section to avoid casts as we have generics, and then ditch the hssf duplicate bit (everyone should be pointed at the ss.usermodel version)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@898750 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/documentation/content/xdocs/spreadsheet/quick-guide.xml20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/documentation/content/xdocs/spreadsheet/quick-guide.xml b/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
index b2feca0679..a959090ac3 100644
--- a/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
+++ b/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
@@ -266,24 +266,14 @@
and Sheet provides a <em>rowIterator()</em> method to
give an iterator over all the rows.</p>
<p>Alternately, Sheet and Row both implement java.lang.Iterable,
- so if you're using Java 1.5, you can simply take advantage
+ so using Java 1.5 you can simply take advantage
of the built in "foreach" support - see below.</p>
<source>
Sheet sheet = wb.getSheetAt(0);
- for (Iterator rit = sheet.rowIterator(); rit.hasNext(); ) {
- Row row = (Row)rit.next();
- for (Iterator cit = row.cellIterator(); cit.hasNext(); ) {
- Cell cell = (Cell)cit.next();
- // Do something here
- }
- }
- </source>
- <source>
- HSSFSheet sheet = wb.getSheetAt(0);
- for (Iterator&lt;HSSFRow&gt; rit = (Iterator&lt;HSSFRow&gt;)sheet.rowIterator(); rit.hasNext(); ) {
- HSSFRow row = rit.next();
- for (Iterator&lt;HSSFCell&gt; cit = (Iterator&lt;HSSFCell&gt;)row.cellIterator(); cit.hasNext(); ) {
- HSSFCell cell = cit.next();
+ for (Iterator&lt;Row&gt; rit = sheet.rowIterator(); rit.hasNext(); ) {
+ Row row = rit.next();
+ for (Iterator&lt;Cell&gt; cit = row.cellIterator(); cit.hasNext(); ) {
+ Cell cell = cit.next();
// Do something here
}
}