Skip to content

Commit

Permalink
initialize the array at creation time
Browse files Browse the repository at this point in the history
  • Loading branch information
ozlerhakan committed Mar 2, 2018
1 parent 9573937 commit dcace72
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/com/poiji/bind/mapping/PoijiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import com.poiji.exception.IllegalCastException;
import com.poiji.option.PoijiOptions;
import com.poiji.util.Casting;
import java.lang.reflect.InvocationTargetException;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.xssf.usermodel.XSSFComment;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

import static org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.*;
import static org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler;

/**
* This class handles the processing of a .xlsx file,
Expand All @@ -35,6 +35,7 @@ final class PoijiHandler<T> implements SheetContentsHandler {
this.type = type;
this.options = options;

dataset = new ArrayList<>();
casting = Casting.getInstance();
}

Expand Down Expand Up @@ -84,10 +85,6 @@ private void setValue(String content, Class<? super T> type, int column) {

@Override
public void startRow(int rowNum) {
if (rowNum == 1) {
dataset = new ArrayList<>();
}

if (rowNum + 1 > options.skip()) {
instance = newInstanceOf(type);
}
Expand Down

0 comments on commit dcace72

Please sign in to comment.