forked from troyzhxu/okhttps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListMapTests.java
More file actions
55 lines (51 loc) · 1.77 KB
/
ListMapTests.java
File metadata and controls
55 lines (51 loc) · 1.77 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package cn.zhxu.okhttps;
import cn.zhxu.data.ArrayListMap;
import cn.zhxu.data.LinkedListMap;
import cn.zhxu.data.ListMap;
import org.junit.Test;
public class ListMapTests {
@Test
public void map() {
long t0 = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
ListMap<Object> map = new ArrayListMap<>();
map.put("name", "jack");
map.put("school", "High School");
map.put("age", 20);
map.put("sex", "Male");
map.put("height", 170);
map.put("type", 2);
map.put("timestamp", "1234567890");
map.put("name", "jack");
map.put("school", "High School");
map.put("age", 20);
map.put("sex", "Male");
map.put("height", 170);
map.put("type", 2);
map.put("timestamp", "1234567890");
map.forEach((key, value) -> { });
}
long t1 = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
ListMap<Object> map = new LinkedListMap<>();
map.put("name", "jack");
map.put("school", "High School");
map.put("age", 20);
map.put("sex", "Male");
map.put("height", 170);
map.put("type", 2);
map.put("timestamp", "1234567890");
map.put("name", "jack");
map.put("school", "High School");
map.put("age", 20);
map.put("sex", "Male");
map.put("height", 170);
map.put("type", 2);
map.put("timestamp", "1234567890");
map.forEach((key, value) -> { });
}
long t2 = System.currentTimeMillis();
System.out.println(t1 - t0);
System.out.println(t2 - t1);
}
}