File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
src/dataStructures/linkedList
test/dataStructures/linkedList Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -312,11 +312,11 @@ public String toString() {
312
312
}
313
313
return ret ;
314
314
}
315
-
315
+
316
316
/**
317
317
* Node class for linked list
318
318
*/
319
- private static class Node <T > {
319
+ public static class Node <T > {
320
320
T val ;
321
321
Node <T > next ;
322
322
@@ -328,5 +328,5 @@ private Node(T val) {
328
328
public String toString () {
329
329
return this .val .toString ();
330
330
}
331
- }
331
+ }
332
332
}
Original file line number Diff line number Diff line change 3
3
import org .junit .Assert ;
4
4
import org .junit .Test ;
5
5
import src .dataStructures .linkedList .LinkedList ;
6
+ import src .dataStructures .linkedList .LinkedList .Node ;
6
7
7
8
public class LinkedListTest {
8
9
@ Test
@@ -35,12 +36,18 @@ public void testSearchAndGet() {
35
36
ll .insert (7 , 6 );
36
37
ll .insert (6 , 6 );
37
38
38
- Integer test1 = ll .search (4 );
39
+ Node < Integer > test1 = ll .get (4 );
39
40
Assert .assertEquals ("4" , test1 .toString ());
40
41
41
- Integer test2 = ll .search (3 );
42
+ Node < Integer > test2 = ll .get (3 );
42
43
Assert .assertEquals ("3" , test2 .toString ());
43
44
45
+ Integer test3 = ll .search (4 );
46
+ Assert .assertEquals ("4" , test3 .toString ());
47
+
48
+ Integer test4 = ll .search (3 );
49
+ Assert .assertEquals ("3" , test4 .toString ());
50
+
44
51
Assert .assertEquals ("0 1 2 3 4 5 6 7 " , ll .toString ());
45
52
}
46
53
You can’t perform that action at this time.
0 commit comments