Skip to content

Commit b63a43e

Browse files
committed
添加HashMap测试类
1 parent 43cc0cd commit b63a43e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/main/java/cn/byhieg/collectiontutorial/maptutorial/HashMapExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ public void getAllKeyAndValue(Map<? extends String, ? extends String> maps) {
2828
Iterator iterator = maps.entrySet().iterator();
2929
while (iterator.hasNext()) {
3030
Map.Entry<String, String> entry = (Map.Entry<String, String>) iterator.next();
31-
System.out.println(entry.getKey());
32-
System.out.println(entry.getValue());
31+
System.out.print("Key = " + entry.getKey());
32+
System.out.println(" value = " + entry.getValue());
3333
}
3434
}
3535

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package cn.byhieg.collectiontutorialtest;
2+
3+
import cn.byhieg.collectiontutorial.maptutorial.HashMapExample;
4+
import junit.framework.TestCase;
5+
6+
import java.util.Map;
7+
8+
/**
9+
* Created by byhieg on 17/2/25.
10+
* Mail to byhieg@gmail.com
11+
*/
12+
public class HashMapExampleTest extends TestCase {
13+
HashMapExample example = new HashMapExample();
14+
public void testInsertMap() throws Exception {
15+
Map<String,String> maps = example.insertMap();
16+
example.getAllKeyAndValue(maps);
17+
}
18+
19+
public void testGetValue() throws Exception {
20+
21+
}
22+
23+
24+
}

0 commit comments

Comments
 (0)