我有以下方法:
这将输出:
感谢您!
public static void showStuff(Multimap<String, String> map) {
for (String key : map.keys()) {
System.out.println("The key, " + key
+ ", has the results: " + map.get(key));
}
}
这将输出:
The key, **one**, has the results: [a,b,c,d,d,e]
The key, **one**, has the results: [a,b,c,d,d,e]
The key, **one**, has the results: [a,b,c,d,d,e]
The key, **one**, has the results: [a,b,c,d,d,e]
The key, **one**, has the results: [a,b,c,d,d,e]
The key, **two**, has the results: [a,a,a,b,b,e]
The key, **two**, has the results: [a,a,a,b,b,e]
我该如何使其仅输出唯一的键。我希望它只打印一次语句,而不是多次重复。我有一个包含重复键的不同行的表,因此我使用MultiMap获取重复键的所有值。现在我要如何仅输出唯一的键。
The key, **one**, has the results: [a,b,c,d,d,e]
The key, **two**, has the results: [a,a,a,b,b,e]
感谢您!