功能描述 | JAVA | C# |
---|---|---|
新建map | Map<String, Integer> map = Maps.newHashMap(); | Dictionary<string, int> dict = new Dictionary<string, int>(); |
循环List | for (String s : list) { System.out.println(s); } | foreach (string s in list){ Console.WriteLine(s); } |
foreach | list.forEach(item -> System.out.println(item)); | list.ForEach(item => Console.WriteLine(item)); |
C# 与 JAVA 常见代码对照表 https://blog.csdn.net/weixin_38214171/article/details/131183737