Updated Doubly Linked List to allow for null values to be added
This commit is contained in:
parent
e8c99f8d5d
commit
a4dfb0f58a
@ -12,7 +12,7 @@
|
|||||||
return new DoublyLinkedList<T>();
|
return new DoublyLinkedList<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DoublyLinkedList<T> Create(T value)
|
public static DoublyLinkedList<T> Create(T? value)
|
||||||
{
|
{
|
||||||
//Create a new Class with a single item
|
//Create a new Class with a single item
|
||||||
return new DoublyLinkedList<T>()
|
return new DoublyLinkedList<T>()
|
||||||
@ -67,7 +67,7 @@
|
|||||||
node!.Value = value;
|
node!.Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void Append(T value)
|
public void Append(T? value)
|
||||||
{
|
{
|
||||||
Count++;
|
Count++;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@
|
|||||||
Tail = Tail.Next;
|
Tail = Tail.Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(int index, T value)
|
public void Insert(int index, T? value)
|
||||||
{
|
{
|
||||||
Count++;
|
Count++;
|
||||||
if (index > Count || index < 0) throw new System.Exception("Error! Index outside of Bounds");
|
if (index > Count || index < 0) throw new System.Exception("Error! Index outside of Bounds");
|
||||||
|
Loading…
Reference in New Issue
Block a user