提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从LinkedHashMap获取密钥集视图
/** 来自 n o w j a v a . c o m**/ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; 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"); Set st = lHashMap.keySet(); System.out.println("Set created from LinkedHashMap Keys contains :"); Iterator itr = st.iterator(); while(itr.hasNext()) /* 来自 *时 代 J a v a*/ System.out.println(itr.next()); st.remove("2");