# 이중 연결 리스트: addFirst(data)
## 문제
뼈대코드를 참조하여, 이중 연결 리스트(doubly linked list)의 `addFirst(data)`메소드를 구현하시오.
## 동작 흐름
<div class="embed-responsive embed-responsive-16by9">
<iframe src="https://www.youtube.com/embed/xKjfXZTJskI" frameborder="0" allowfullscreen></iframe>
</div>
## 출력 예
```
list: head -> 33 -> 22 -> 11 -> null
list: tail -> 11 -> 22 -> 33 -> null
```
## 뼈대코드
```
public class DoublyLinkedListTest {
public static void main(String[] args) {
DoublyLinkedList list = new DoublyLinkedList();
list.addFirst(11);
list.addFirst(22);
list.addFirst(33);
System.out.println(list.toString());
System.out.println(list.toStringBackward());
}
}
class DoublyLinkedList {
private Node head;
private Node tail;
public DoublyLinkedList() {
this.head = null;
this.tail = null;
}
public void addFirst(int data) {
/* 해당 메소드를 구현하시오. */
}
public String toString() {
StringBuffer sbuf = new StringBuffer("list: head -> ");
Node temp = head;
while (temp != null) {
sbuf.append(temp.data + " -> ");
temp = temp.right;
}
return sbuf.append("null").toString();
}
public String toStringBackward() {
StringBuffer sbuf = new StringBuffer("list: tail -> ");
Node temp = tail;
while (temp != null) {
sbuf.append(temp.data + " -> ");
temp = temp.left;
}
return sbuf.append("null").toString();
}
class Node {
int data;
Node left;
Node right;
private Node(int data, Node left, Node right) {
this.data = data;
this.left = left;
this.right = right;
}
}
}
```