Browse Source

解决当Data是LinkedList时,随着数据量增加性能变差

入参为List,当List是LinkedList时,get方法性能很差
developing
Wenyi Zhou 5 years ago committed by GitHub
parent
commit
0b1cc38336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java

6
src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java

@ -46,9 +46,11 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor {
}
// BeanMap is out of order,so use fieldList
List<Field> fieldList = new ArrayList<Field>();
for (int relativeRowIndex = 0; relativeRowIndex < data.size(); relativeRowIndex++) {
int relativeRowIndex=0;
for(Object oneRowData : data){
int n = relativeRowIndex + newRowIndex;
addOneRowOfDataToExcel(data.get(relativeRowIndex), n, relativeRowIndex, fieldList);
addOneRowOfDataToExcel(oneRowData, n, relativeRowIndex, fieldList);
relativeRowIndex++;
}
}

Loading…
Cancel
Save