You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2010/01/13 14:46:37 UTC
svn commit: r898750 -
/poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
Author: nick
Date: Wed Jan 13 13:46:36 2010
New Revision: 898750
URL: http://svn.apache.org/viewvc?rev=898750&view=rev
Log:
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)
Modified:
poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
Modified: poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml?rev=898750&r1=898749&r2=898750&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/spreadsheet/quick-guide.xml Wed Jan 13 13:46:36 2010
@@ -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<HSSFRow> rit = (Iterator<HSSFRow>)sheet.rowIterator(); rit.hasNext(); ) {
- HSSFRow row = rit.next();
- for (Iterator<HSSFCell> cit = (Iterator<HSSFCell>)row.cellIterator(); cit.hasNext(); ) {
- HSSFCell cell = cit.next();
+ for (Iterator<Row> rit = sheet.rowIterator(); rit.hasNext(); ) {
+ Row row = rit.next();
+ for (Iterator<Cell> cit = row.cellIterator(); cit.hasNext(); ) {
+ Cell cell = cit.next();
// Do something here
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org