提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
遍历LinkedHashMap的值
import java.util.Collection; import java.util.LinkedHashMap; import java.util.Iterator; /*来自 nowjava.com - 时 代 Java*/ public class Main { public static void main(String[] args) { LinkedHashMap lHashMap = new LinkedHashMap(); //add key value pairs to LinkedHashMap lHashMap.put("1","One"); lHashMap.put("2","Two"); lHashMap.put("3","Three"); Collection c = lHashMap.values(); //obtain an Iterator for Collection /** from N o w J a v a . c o m**/ Iterator itr = c.iterator