-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
28 lines (26 loc) · 853 Bytes
/
Main.java
File metadata and controls
28 lines (26 loc) · 853 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
package structires.queue;
/**
* Created : zzc
* Time : 2017/9/25
* Email : zzcm159@gmail.com
* Description :
*/
class Main {
public static void main(String arg[]) {
ArrayQueue<String> queue = new ArrayQueue<>();
for (int i = 0; i < 10; i++) {
queue.offer("item" + i);
}
Queue<String> queue2 = new ArrayQueue<>();
long last = System.currentTimeMillis();
for (int i = 0; i < 1000000; i++) {
queue2.offer("item" + i);
}
System.out.println("ArrayQueue:offer 1000000 and time is :" + (System.currentTimeMillis() - last));
last = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
queue2.poll();
}
System.out.println("ArrayQueue:poll 100000 and time is :" + (System.currentTimeMillis() - last));
}
}