File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
hamill/src/main/java/com/codesquad/datastructurestudy/linkedlist Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .codesquad .datastructurestudy .linkedlist ;
2
2
3
3
public class LinkedList {
4
+ // 첫 번째 노드를 가리키는 필드
5
+ private Node head ;
6
+ private Node tail ;
7
+ private int size = 0 ;
8
+
9
+ private class Node {
10
+ // 데이터가 저장될 필드
11
+ private Object data ;
12
+ // 다음 노드를 가리키는 필드
13
+ private Node next ;
14
+ public Node (Object input ) {
15
+ this .data = input ;
16
+ this .next = null ;
17
+ }
18
+ // 노드의 내용을 쉽게 출력해서 확인 해볼 수 있는 기능
19
+ public String toString () {
20
+ return String .valueOf (this .data );
21
+ }
22
+ }
23
+
24
+
4
25
}
Original file line number Diff line number Diff line change
1
+ package com .codesquad .datastructurestudy .linkedlist ;
2
+
3
+ public class Main {
4
+
5
+ public static void main (String [] args ) {
6
+ LinkedList numbers = new LinkedList ();
7
+ }
8
+ }
You can’t perform that action at this time.
0 commit comments