You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2007/11/19 18:41:51 UTC

DO NOT REPLY [Bug 43905] New: - Have the HSSFSheet and HSSFRow implement the Iterator interface

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43905

           Summary: Have the HSSFSheet and HSSFRow implement the Iterator
                    interface
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: mail@noelmarkham.com


Have the HSSFSheet and HSSFRow implement the Iterator interface - this would
allow the Java 5 foreach to be used resulting in cleaner code. Considering there
is only one Iterator method on each class, it is clear what the iterator() class
would return.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 43905] - Have the HSSFSheet and HSSFRow implement the Iterator interface

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43905


nick@torchbox.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From nick@torchbox.com  2008-02-05 08:35 -------
It seems that the way sun introduced foreach loops in java 1.5 was rather
stupid, and prevents your code from then working on java 1.4. Since we require
java 1.4 compatibility, we can't implement java.lang.Iterable (though trunk does
have the method that that requires). For now, you'll need to just use the normal
iterator methods

In the ooxml branch, we do have some workarounds for java 1.4 vs java 1.5
features, so Sheet/HSSFSheet/XSSFSheet and Row/HSSFRow/XSSFRow do implement
java.lang.Iterable (when build on java 1.5), so foreach loops will work there.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 43905] - Have the HSSFSheet and HSSFRow implement the Iterator interface

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43905


nick@torchbox.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Additional Comments From nick@torchbox.com  2007-12-04 04:06 -------
HSSFRow.cellIterator and HSSFSheet.rowIterator should already provide what you
want. Use row.cellIterator or sheet.rowIterator in your foreach loop


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 43905] - Have the HSSFSheet and HSSFRow implement the Iterator interface

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43905





------- Additional Comments From leifarne@storset.net  2008-02-05 07:05 -------
Additionally, the Iterator returned by iterator() should be typed - i. e. 
return an Iterator<HSSFRow> or Iterator<HSSFSheet>. This avoids compiler 
warnings about type safety and increases user confidence.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 43905] - Have the HSSFSheet and HSSFRow implement the Iterator interface

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43905


leifarne@storset.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




------- Additional Comments From leifarne@storset.net  2008-02-04 23:51 -------
Sadly, Nick Burch is mistaken. If you test the code sample "Iterate over rows 
and cells (including Java 5 foreach loops)" at http://poi.apache.org/hssf/quick-
guide.html#Iterator, you will find that it generates a compiler error "Can only 
iterate over an array or an instance of java.lang.Iterable". (Was this tested 
before publishing?)

For this to work, Noel Markham's original suggestion should be implemented. For 
HSSFSheet and HSSFRow to be Iterable, there must be a method called iterator(). 
Alternatively (and perhaps more logically), you could return Iterable data 
structures through HSSFSheet.rows() and HSSFRow.cells().

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 43905] - Have the HSSFSheet and HSSFRow implement the Iterator interface

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43905>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43905





------- Additional Comments From nick@torchbox.com  2008-02-05 07:23 -------
(In reply to comment #3)
> Additionally, the Iterator returned by iterator() should be typed - i. e. 
> return an Iterator<HSSFRow> or Iterator<HSSFSheet>. This avoids compiler 
> warnings about type safety and increases user confidence.

Typing requires Java 1.5, and POI is aiming to stay working with Java 1.4, so
that isn't going to be possible


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org