zouxuan vor 5 Jahren
Ursprung
Commit
860e015acf
1 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen
  1. 10 2
      mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

+ 10 - 2
mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

@@ -112,7 +112,11 @@ public class MapUtil {
 	 * @describe mybatis返回结果转换为Map
 	 */
 	public static <T,K> Map convertMybatisMap(List<Map<T,K>> maps){
-		Map result=new HashMap(maps.size());
+		int size = 0;
+		if(maps != null){
+			size = maps.size();
+		}
+		Map result=new HashMap(size);
 		maps.forEach(stringIntegerMap -> {
 			if(Objects.isNull(stringIntegerMap)){
 				return;
@@ -130,7 +134,11 @@ public class MapUtil {
 	 * @describe mybatis返回结果转换为Map
 	 */
 	public static <T,K> Map convertIntegerMap(List<Map<T,K>> maps){
-		Map result=new HashMap(maps.size());
+		int size = 0;
+		if(maps != null){
+			size = maps.size();
+		}
+		Map result=new HashMap(size);
 		maps.forEach(stringIntegerMap -> {
 			if(Objects.isNull(stringIntegerMap)){
 				return;