请帮我创建一个循环遍历 LinkedHashMap<String,ArrayList<String>> h
:
if (h.get("key1").size() == 0)
System.out.println("There is no errors in key1.");
else
System.out.println("ERROR: there are unexpected errors in key1.");
if (h.get("key2").size() == 0)
System.out.println("There is no errors in key2.");
else
System.out.println("ERROR: there are unexpected errors in key2.");
if (h.get("key3").size() == 0)
System.out.println("There is no errors in key3.");
else
System.out.println("ERROR: there are unexpected errors in key3.");
if (h.get("key4").size() == 0)
System.out.println("There is no errors in key4.\n");
else
System.out.println("ERROR: there are unexpected errors in key4.\n");
LinkedHashMap
的 Java 文档与HashMap
完全相同。 - edthethirdLinkedHashMap
保证有序,但并非所有的HashMaps
都能保证:https://dev59.com/YXA85IYBdhLWcg3wJf8Z#2924143 - vsocrates