数据结构如下,正常的图AND不正常的图
如果key对应value肯定没有某些字符的话可以使用string的indexof去判断是否是数组
listMap.forEach(item -> item.forEach((k, v) -> { if (v != null) { if (v instanceof List) { v = ((List<?>) v).get(0); } else if (v.getClass().isArray()) { Object[] tempArray = (Object[]) v; if (tempArray.length > 0) { v = tempArray[0]; } } item.put(k, v); } }));