!854 update 优化使用getFirst()替代get(0)以提高代码可读性
* update 优化使用getFirst()替代get(0)以提高代码可读性
This commit is contained in:
+1
-1
@@ -66,7 +66,7 @@ public class CellMergeHandler {
|
||||
}
|
||||
|
||||
// 获取有合并注解的字段
|
||||
Map<Field, FieldColumnIndex> mergeFields = getFieldColumnIndexMap(rows.get(0).getClass());
|
||||
Map<Field, FieldColumnIndex> mergeFields = getFieldColumnIndexMap(rows.getFirst().getClass());
|
||||
// 如果没有需要合并的字段则返回空集
|
||||
if (CollUtil.isEmpty(mergeFields)) {
|
||||
return Collections.emptyList();
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ public class DropDownOptions {
|
||||
sonList.forEach(everySon -> {
|
||||
if (parentGroupByIdMap.containsKey(sonHowToGetParentIdFunction.apply(everySon))) {
|
||||
// 找到对应的上级
|
||||
T parentObj = parentGroupByIdMap.get(sonHowToGetParentIdFunction.apply(everySon)).get(0);
|
||||
T parentObj = parentGroupByIdMap.get(sonHowToGetParentIdFunction.apply(everySon)).getFirst();
|
||||
// 提取名称和ID作为Key
|
||||
String key = howToBuildEveryOption.apply(parentObj);
|
||||
// Key对应的Value
|
||||
|
||||
+2
-2
@@ -282,10 +282,10 @@ public class ExcelDownHandler implements SheetWriteHandler {
|
||||
continue;
|
||||
}
|
||||
// 取第一个
|
||||
String str = data.get(0);
|
||||
String str = data.getFirst();
|
||||
rowData.add(str);
|
||||
// 通过移除的方式避免重复
|
||||
data.remove(0);
|
||||
data.removeFirst();
|
||||
// 设置可以继续
|
||||
flag = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user