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 54921f9 commit a6dd345Copy full SHA for a6dd345
yoonexample/src/main/java/deque/LinkedListDeque.java
@@ -18,12 +18,30 @@ public boolean isEmpty() {
18
19
@Override
20
public void addFirst(E data) {
21
+ Node<E> newNode = new Node<>(data);
22
+ if (isEmpty()) {
23
+ this.tail = newNode;
24
+ } else {
25
+ this.head.prev = newNode;
26
+ }
27
28
+ newNode.next = this.head;
29
+ this.head = newNode;
30
+ this.size++;
31
}
32
33
34
public void addLast(E data) {
35
36
37
38
39
+ this.tail.next = newNode;
40
41
42
+ newNode.prev = this.tail;
43
44
45
46
47
0 commit comments