package org.sfm.poi;

import org.apache.poi.ss.usermodel.Sheet;
import org.sfm.utils.RowHandler;

import java.util.Iterator;
//IFJAVA8_START
import java.util.stream.Stream;
//IFJAVA8_END

public interface SheetMapper<T> {

    /**
     *
     * @param sheet the sheet to map from
     * @return an iterator of mapped instance of T
     */
    Iterator<T> iterator(Sheet sheet);

    /**
     *
     * @param startRow row index to start at
     * @param sheet the sheet to map from
     * @return an iterator of mapped instance of T
     */
    Iterator<T> iterator(int startRow, Sheet sheet);

    /**
     *
     * @param sheet the sheet to map from
     * @param rowHandler the handler to call back
     * @param <RH> the type of the handler
     * @return the handler
     */
    <RH extends RowHandler<T>> RH forEach(Sheet sheet, RH rowHandler);

    /**
     *
     * @param startRow row index to start at
     * @param sheet the sheet to map from
     * @param rowHandler the handler to call back
     * @param <RH> the type of the handler
     * @return the handler
     */
    <RH extends RowHandler<T>> RH forEach(int startRow, Sheet sheet, RH rowHandler);

    //IFJAVA8_START
    /**
     *
     * @param sheet the sheet to map from
     * @return a stream on mapped instance of T
     */
    Stream<T> stream(Sheet sheet);

    /**
     *
     * @param startRow row index to start at
     * @param sheet the sheet to map from
     * @return a stream on mapped instance of T
     */
    Stream<T> stream(int startRow, Sheet sheet);
    //IFJAVA8_END
}

@@ -1164,28 +1164,9 @@
 );%0A%0A
-    //IFJAVA8_START
 %0A
+
     
@@ -1266,32 +1266,52 @@
 ce of T%0A     */%0A
+    //IFJAVA8_START%0A
     Stream%3CT%3E st
@@ -1320,32 +1320,50 @@
 am(Sheet sheet);
+%0A    //IFJAVA8_END
 %0A%0A    /**%0A     *
@@ -1494,32 +1494,32 @@
 stance of T%0A
-
      */%0A
     Stream%3CT
@@ -1502,24 +1502,44 @@
 f T%0A     */%0A
+    //IFJAVA8_START%0A
     Stream%3CT

fix java7