Skip to content

Commit 542423b

Browse files
committed
attempt #2: fixing formatting
1 parent db58c32 commit 542423b

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/com/codefortomorrow/advanced/chapter16/practice/LinkedList.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @author ArmeetJatyani
55
* March 2021
6-
*
6+
*
77
* Implement a simple LinkedList
88
* You will need to create a LinkedListNode class, which represents each item/node in the linked list
99
* Required functionality...
@@ -16,11 +16,11 @@
1616
*/
1717

1818
public class LinkedList {
19+
1920
public static void main(String[] args) {
2021
// write your code here
21-
22-
}
2322

23+
}
2424
}
2525

26-
class LinkedListNode
26+
class LinkedListNode {}

src/com/codefortomorrow/advanced/chapter16/solutions/LinkedList.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package com.codefortomorrow.advanced.chapter16.solutions;
22

3-
// using Lombok for Getters and Setters
4-
import lombok.Setter;
3+
// UUID to represent each node's unique ID
4+
import java.util.UUID;
55
import lombok.AllArgsConstructor;
66
import lombok.Getter;
7+
// using Lombok for Getters and Setters
8+
import lombok.Setter;
79
import lombok.Setter;
8-
// UUID to represent each node's unique ID
9-
import java.util.UUID;
1010

1111
/**
1212
* @author ArmeetJatyani
1313
* March 2021
14-
*
14+
*
1515
* Implement a simple LinkedList
1616
* You will need to create a LinkedListNode class, which represents each item/node in the linked list
1717
* Required functionality...
@@ -25,6 +25,7 @@
2525

2626
@Setter
2727
public class LinkedList {
28+
2829
private LinkedListNode head;
2930

3031
/**
@@ -57,7 +58,7 @@ public LinkedListNode head() {
5758
*/
5859
public LinkedListNode tail() {
5960
LinkedListNode current = head;
60-
if(current == null) return null;
61+
if (current == null) return null;
6162

6263
while (current.getNext() != null) {
6364
current = current.getNext();
@@ -107,22 +108,21 @@ public LinkedListNode pop() {
107108
public String toString() {
108109
String list = "[";
109110
LinkedListNode current = head;
110-
if(current == null) return null;
111+
if (current == null) return null;
111112
do {
112113
list += Integer.toString(current.getValue()) + ", ";
113114
current = current.getNext();
114-
}
115-
while (current != null);
115+
} while (current != null);
116116

117117
list = list.substring(0, list.length() - 2);
118118
return list + "]";
119119
}
120-
121120
}
122121

123122
@Getter
124123
@Setter
125124
class Node {
125+
126126
private UUID ID;
127127
private int value;
128128

@@ -135,10 +135,11 @@ public int value() {
135135
return this.value;
136136
}
137137
}
138-
138+
139139
@Getter
140140
@Setter
141141
class LinkedListNode extends Node {
142+
142143
private LinkedListNode next;
143144

144145
public LinkedListNode(int value, LinkedListNode next) {
@@ -150,4 +151,3 @@ public LinkedListNode next() {
150151
return this.next;
151152
}
152153
}
153-

0 commit comments

Comments
 (0)