-1
LinkedHashMap을 사용하여 Excel 파일의 데이터를 읽고 mysql 테이블에 저장합니다! 내림차순 ID를 사용하여 데이터를 저장하도록 LinkedHashMap을 정렬 할 수 있습니까? 여기 내 엑셀 파일의 예이다 :ID를 사용하여 LinkedHashMap 정렬
ID 이름 연봉
50 크리스틴 2,349,000
43 폴리나 1,245,874
54 로라 4,587,894
아래 코드 저장소에 대한 인 엑셀 파일의 데이터 인 표!
private static LinkedHashMap[] parseExcelColumnData(List sheetData) {
LinkedHashMap[] tousRows = new LinkedHashMap[sheetData.size() - 1];
for (int rowCounter = 1; rowCounter < sheetData.size(); rowCounter++) {
List list = (List) sheetData.get(rowCounter);
LinkedHashMap<String, Integer> tableFields = new LinkedHashMap(list.size());
String str;
String[] tousFields = new String[list.size()];
int i = 0;
for (int j = 0; j < list.size(); j++) {
Cell cell = (Cell) list.get(j);
if (cell != null) {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
tableFields.put(String.valueOf(cell
.getNumericCellValue()), cell.getCellType());
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
tableFields.put(cell.getStringCellValue(), cell
.getCellType());
} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
tableFields.put(String.valueOf(cell
.getBooleanCellValue()), cell.getCellType());
}
}
}
tousRows[rowCounter - 1] = tableFields;
}
return tousRows;
}
를 기반으로하기 때문에
Set<Integer> keys
지금 정렬 된 순서로 모든지도 키를 포함 : 당신이 대신 수행 할 수있는예를 들어, 모든 키를 추출하고 분류입니다 가능한 중복 [Sorting LinkedHashMap] (0120)을 참조하십시오. – durron597
@AndrewThompson 그는 검색 상자에 "linked linkedhashmap"을 입력하지 않았습니다. – durron597
나는 treeMap에 대해 읽은 다음 분리 기호 그러나 나는 무언가를 성공시키지 못했습니다! 왜 내가 여기서 묻고 있습니까? – dedmar