daniel-shuy commented on a change in pull request #290:
URL: https://github.com/apache/poi/pull/290#discussion_r774054291



##########
File path: 
poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
##########
@@ -1269,6 +1272,19 @@ public String getSheetName(int sheetIx) {
         return sheetIterator();
     }
 
+    /**
+     * Returns a spliterator of the sheets in the workbook
+     * in sheet order. Includes hidden and very hidden sheets.
+     *
+     * @return a spliterator of the sheets.
+     *
+     * @since POI 5.2.0
+     */
+    @Override
+    public Spliterator<Sheet> spliterator() {
+        return new SheetSpliterator();

Review comment:
       Its actually the same, because `SheetSpliterator` is delegating to 
`sheets.spliterator()`, which is actually calling 
`Spliterators.spliterator(this, Spliterator.ORDERED)`.
   
   I added `SheetSpliterator` to be consistent with `sheetIterator()`, which 
creates an instance of `SheetIterator` to delegate `sheets.iterator()`. But now 
that I think about it, its probably better to simply do a cast, reducing an 
object instantiation, eg.
   ```java
   @Override
   @SuppressWarnings("unchecked")
   public Spliterator<Sheet> spliterator() {
       return (Spliterator<Sheet>)(Spliterator<? extends Sheet>) 
sheets.spliterator();
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to