标签:rgs for static public imp keyset 最简 key new
import java.util.HashMap; import java.util.Map; public class EntrySets { public static void main(String[] args) { Map<Object, Object> map = new HashMap<Object, Object>(); map.put("k1", "v1"); map.put("k2", "v2"); getItem(map); } static void getItem(Map map) { map.forEach((key, value) -> print(key + ":" + value)); } static void iterByKey(Map map) { /** iter map by key */ for (Object k : map.keySet()) { String v = map.get(k).toString(); } } static void print(Object o) { System.out.println(o); } }
标签:rgs for static public imp keyset 最简 key new
原文地址:https://www.cnblogs.com/SunshineKimi/p/12233373.html