We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f0c2b8 commit 3c30de9Copy full SHA for 3c30de9
group07/724319952/src/cn/fyl/first/Queue.java
@@ -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