forked from b3601993/CodeTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestHashMap.java
More file actions
30 lines (27 loc) · 805 Bytes
/
Copy pathTestHashMap.java
File metadata and controls
30 lines (27 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import org.junit.Test;
import java.util.HashMap;
import java.util.UUID;
/**
* Created by Jikai Zhang on 2017/4/16.
*/
public class TestHashMap {
@Test
public void test() throws InterruptedException {
final HashMap<String, String> map = new HashMap<String, String>(2);
Thread t = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 1000000; i++) {
new Thread(new Runnable() {
@Override
public void run() {
map.put(UUID.randomUUID().toString(), "");
}
}, "ftf" + i).start();
}
}
}, "ftf");
t.start();
t.join();
}
}