Skip to content

Commit 99b0c68

Browse files
author
Gonzalo Diaz
committed
[REFACTOR] File may only contain a single type. (SA1402)
1 parent 8fbdd56 commit 99b0c68

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.linked_list.lib;
2+
3+
public static class LinkedListPrinter
4+
{
5+
public static void printSinglyLinkedList<T>(LinkedList<T>.Node? node, string sep, TextWriter textWriter)
6+
{
7+
var pointTo = node;
8+
9+
while (pointTo != null)
10+
{
11+
ArgumentNullException.ThrowIfNull(textWriter);
12+
13+
textWriter.Write(pointTo.data);
14+
15+
pointTo = pointTo.next;
16+
17+
if (pointTo != null)
18+
{
19+
textWriter.Write(sep);
20+
}
21+
}
22+
}
23+
}

src/algorithm_exercises_csharp/hackerrank/interview_preparation_kit/linked_list/lib/Node.cs

-22
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
namespace algorithm_exercises_csharp.hackerrank.interview_preparation_kit.linked_list.lib;
22

3-
public static class LinkedListPrinter
4-
{
5-
public static void printSinglyLinkedList<T>(LinkedList<T>.Node? node, string sep, TextWriter textWriter)
6-
{
7-
var pointTo = node;
8-
9-
while (pointTo != null)
10-
{
11-
ArgumentNullException.ThrowIfNull(textWriter);
12-
13-
textWriter.Write(pointTo.data);
14-
15-
pointTo = pointTo.next;
16-
17-
if (pointTo != null)
18-
{
19-
textWriter.Write(sep);
20-
}
21-
}
22-
}
23-
}
24-
253
public static class LinkedList<T>
264
{
275
public class Node(T nodeData)

0 commit comments

Comments
 (0)