Skip to content

Commit 5bc527e

Browse files
committed
HashMapReader 输出内容保持顺序
1 parent e40d5dd commit 5bc527e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/main/java/com/yanglb/codegen/core/reader/impl/HashMapReaderImpl.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import com.yanglb.codegen.utils.StringUtil;
2020

2121
import java.util.HashMap;
22+
import java.util.LinkedHashMap;
2223
import java.util.List;
2324

2425
import org.apache.poi.ss.usermodel.CellType;
@@ -30,14 +31,14 @@
3031
*
3132
* @author yanglibing
3233
*/
33-
public class HashMapReaderImpl extends BaseReader<HashMap<String, String>> {
34+
public class HashMapReaderImpl extends BaseReader<LinkedHashMap<String, String>> {
3435

3536
/**
3637
* 读取Sheet内容
3738
*/
3839
@Override
39-
protected HashMap<String, String> onReader(XSSFSheet sheet) {
40-
HashMap<String, String> result = new HashMap<String, String>();
40+
protected LinkedHashMap<String, String> onReader(XSSFSheet sheet) {
41+
LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
4142

4243
for (int row = this.startRowNo; row <= sheet.getLastRowNum(); row++) {
4344
XSSFRow xssfRow = sheet.getRow(row);
@@ -56,8 +57,8 @@ protected HashMap<String, String> onReader(XSSFSheet sheet) {
5657
/**
5758
* 合并
5859
*/
59-
public HashMap<String, String> mergeResult(List<HashMap<String, String>> listMap) {
60-
HashMap<String, String> result = new HashMap<String, String>();
60+
public LinkedHashMap<String, String> mergeResult(List<LinkedHashMap<String, String>> listMap) {
61+
LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
6162
for (HashMap<String, String> itm : listMap) {
6263
result.putAll(itm);
6364
}

0 commit comments

Comments
 (0)