我想更改java.util.HashMap条目的格式。 为此,我尝试像这样的细节格式化程序:
entrySet().stream()
.map(e -> String.format("%-40s -> %s", e.getKey(), e.getValue()))
.collect(java.util.stream.Collectors.joining("\n", "{", "}"))
但是Eclipse向我显示了以下消息:
Detail formatter error:
The method entrySet() is undefined for the type HashMap<K,V>
我缺少什么?