日期:2014-05-20 浏览次数:20892 次
LinkedHashMap<Integer, String> integers = new LinkedHashMap<Integer, String>(); for (int i = 0; i < 25; i++) { integers.put(i, "value"+i ); } int pos = 0; for (Iterator<Integer> iterator = integers.keySet().iterator(); iterator.hasNext(); pos++) { String result = integers.get(iterator.next()); if (pos >= 3 && pos <= 21) System.out.println(result); }
------解决方案--------------------
int j = 1; for (Entry<String, String> mapx : map.entrySet()) { j++; if (j > 10) { System.out.println(mapx.getKey()); } }