提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
检查LinkedHashMap中是否存在特定密钥
import java.util.LinkedHashMap; /**来自 时 代 J a v a - N o w J a v a . c o m**/ public class Main { public static void main(String[] args) { LinkedHashMap lHashMap = new LinkedHashMap(); lHashMap.put("1","One"); lHashMap.put("2","Two"); lHashMap.put("3","Three"); boolean blnExists = lHashMap.containsKey("3"); System.out.println("3 exists in LinkedHashMap ? : " + blnExists); } }