接收一个List<Map<String, Object>>关于,怎么能map的list只取下标0

数据结构如下,正常的图AND不正常的图

img

img

如果key对应value肯定没有某些字符的话可以使用string的indexof去判断是否是数组

List<Map<String, Object>>你的意思是,这里面的Object可能也是个list,只希望取第一个,是吗?

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); } }));