java8-遍历map

 Map<Long, String> map = new HashMap<Long, String>();
 map.put(1L, "ABC");
 map.put(2L, "KK");
 map.put(3L, "LV");
		 
 map.forEach((k,v)->{System.out.println(k + " = " + v);});
 
 map.forEach((k,v)->System.out.println(k + " = " + v));


结果:

1 = ABC
2 = KK
3 = LV

    原文作者:leolu007
    原文地址: https://blog.csdn.net/Leolu007/article/details/53996816
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞