我正在从数据库查询检索结果为 List<Map<String, Object>>
格式,你能建议一下,如何将其转换为 List<Map<String, String>>
.
最佳答案
迭代列表,依次转换每个 map :
list.stream()
.map(map ->
map.entrySet().stream()
.collect(
Collectors.toMap(
Entry::getKey, e -> e.getValue().toString())))
.collect(Collectors.toList())
关于java - 如何将 List<Map<String, Object>> 转换为 List<Map<String, String>>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61603735/