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 2015/09/06 11:19:53 UTC

[Bug 58245] Make Workbook interface iterable over sheets

https://bz.apache.org/bugzilla/show_bug.cgi?id=58245

Javen ONeal <ja...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33001|0                           |1
        is obsolete|                            |

--- Comment #5 from Javen ONeal <ja...@gmail.com> ---
Created attachment 33066
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33066&action=edit
patch to make all workbooks implement Iterable<Sheet>

The XSSFWorkbook.iterator breaks that pattern used by Sheet.iterator and
Row.iterator

Unfortunately, XSSFWorkbook has had this method for nearly 7 years (r700472
https://svn.apache.org/viewvc?view=revision&revision=700472).
Nonetheless, I think deprecating the old iterator is a step in the right
direction, allowing developers to write for loops like

for (Sheet sh : workbook) {
    for (Row row : sh) {
        for (Cell cell : row) {
            System.out.println(cell);
        }
    }
}

I've provided test cases and documentation to help users transition their code
to the new Iterator<Sheet> iterator() interface (previously Iterator<XSSFSheet>
iterator().

Note: this patch will break backwards compatibility with existing code.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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