常用iterate 方法

 Map<Integer, String> m = new HashMap<Integer, String>();
for(Map.Entry<Integer, String> entry : m.entrySet()){
System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue());
} Iterator<Map.Entry<Integer, String>> iterator = m.entrySet().iterator();
while(iterator.hasNext()){
Map.Entry entry = iterator.next();
System.out.println("Key: " + entry.getKey() + ", Value: " + entry.getValue());
}
 for(Character key : hm.keySet()){
System.out.println("Key: " + key + " Value: " + hm.get(key));
}

How to Iterate Map的更多相关文章

  1. Java How to Iterate Map

    常用iterate 方法 Map<Integer, String> m = new HashMap<Integer, String>(); for(Map.Entry<I ...

  2. java之Map的使用

    Map的实现类有很多,其中较为常见的有HashMap,HashTable,LinkedHashMap,TreeMap,下面分别对这几个类进行简单的分析: 1.HashMap HashMap的结构数组+ ...

  3. FEE Development Essentials

    FEE Development Essentials JS Basic function call() and apply() func1.bind(thisObj,arg1...argn) Cust ...

  4. Lambdas in Java 8--reference

    Part 1 reference:http://jaxenter.com/lambdas-in-java-8-part-1-49700.html Get to know lambda expressi ...

  5. 18. 4Sum (JAVA)

    Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums s ...

  6. C++ Style Languages: C++, Objective-C, Java, C#

    Hyperpolyglot.org From Hyperpolyglot.org C++ Style Languages: C++, Objective-C, Java, C# a side-by-s ...

  7. LeetCode 884. Uncommon Words from Two Sentences (两句话中的不常见单词)

    题目标签:HashMap 题目给了我们两个句子,让我们找出不常见单词,只出现过一次的单词就是不常见单词. 把A 和 B 里的word 都存入 map,记录它们出现的次数.之后遍历map,把只出现过一次 ...

  8. 【UE4 C++】资源烘焙与UE4Editor.exe启动

    资源烘焙 虚幻引擎以内部使用的特定格式存储内容资源,将内容从内部格式转换为特定于平台的格式的过程 称为 烘焙((Cooking) 从编辑器烘焙资源 FIle → Cook Content for Wi ...

  9. How to Iterate Over a Map in Java?(如何遍历Map)

    1.Iterate through the "entrySet" like so: public static void printMap(Map mp) { Iterator i ...

随机推荐

  1. php 数组操作

    <?php $vegetables[0] = "corn"; $vegetables[1] = "broccoli"; $vegetables[2] = ...

  2. php文件以二进制形式上传并放入到数据库中

    conn.php: <?php $id=mysql_connect('localhost','root','root'); mysql_select_db("db_database12 ...

  3. POJ 2777 Count Color(线段树染色,二进制优化)

    Count Color Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 42940   Accepted: 13011 Des ...

  4. php处理数组函数大全

    PHP:指示支持该函数的最早的 PHP 版本. 函数 描述 PHP array() 创建数组. 3 array_change_key_case() 返回其键均为大写或小写的数组. 4 array_ch ...

  5. 让apache不区分图片和文件后缀大小写

    加载mod_speling模块: LoadModule speling_module /usr/lib/apache2/modules/mod_speling.so 开启模块: CheckSpelli ...

  6. (一)win7下cocos2d-x 21 + vs2010

    1.下载SDK http://cocos2d.cocoachina.com/download,我下载2.1版本,cocos2d-2.1rc0-x-2.1.2-hotfix.zip @ Apr.08, ...

  7. SHELL 中的重定向和管道

    1. 什么叫重定向将输入或输出重新指定到别的位置. 2. 重定向输出2.1.命令执行数据流文件/设备---- 标准输入 -->命令 --- 标准输出 -->文件/设备            ...

  8. QQ群笔记

     uuid就好比你的名字,类似到了班级里,你的名字会被学号替代.同样的连接之后,uuid会被handle句柄替代.   问下CC2541串口用DMA接收的时候,调试程序时候发现,串口发一帧数据,进入两 ...

  9. php-fpm

    install php-fpm # Ubuntu sudo apt-get install python-software-properties; sudo add-apt-repository pp ...

  10. 线性表集合A=A B

    大话数据结构 void union(List *a, List Lb) { int La_len, Lb_len, i; ElemType e; La_len = ListLength(La); Lb ...