Skip to content

Commit 3c30de9

Browse files
author
lgt
committed
test
1 parent 5f0c2b8 commit 3c30de9

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package cn.fyl.first;
2+
3+
public class Queue {
4+
5+
LinkedList linkedlist = new LinkedList();
6+
7+
public void enQueue(Object o){
8+
linkedlist.addLast(o);
9+
}
10+
11+
public Object deQueue(){
12+
return linkedlist.removeFirst();
13+
}
14+
15+
public boolean isEmpty(){
16+
if(linkedlist.size()>0)
17+
return false;
18+
else
19+
return true;
20+
}
21+
22+
public int size(){
23+
return linkedlist.size();
24+
}
25+
26+
public Object get(int index){
27+
return linkedlist.get(index);
28+
}
29+
30+
public static void main(String[] arg){
31+
Queue q = new Queue();
32+
q.enQueue(1);
33+
q.enQueue(2);
34+
System.out.println(q.get(1));
35+
}
36+
37+
}

0 commit comments

Comments
 (0)