我在下面的代码中将键值对插入hashmap。
HashMap<String, String> result = new HashMap<String, String>();
result.put("Description", "true";
result.put("System Menu Program", "false");
result.put("User ID Code", "false");
result.put("User ID Version", "true");
我试图通过连接多个输出字符串来迭代要打印的结果。目前我正在使用String.join加入包含false作为值的结果,但我面临的问题是我需要使用String.join的任何替代,因为String.join方法已在java 1.8中发布但我们的服务器正在使用1.6是否有替代方法来替换以下功能
List<String> a1 = new ArrayList<String>();
for (String key : result.keySet()) {
if (result.get(key).contains("false")){
a1.add(result.get(key));
finalResult = String.join(" // ", a1 );
}
}
System.out.println(finalResult);
return finalResult;