I have a double linked list (queue) that I made myself.
I am wondering, in order to clear the linked list, is it enough to simply remove links to the head and tail?
For example,
public void Clear()
{
Head = null;
Tail = null;
}
I create a domino effect, but it's hard for me to test it. This will cause the entire object to be empty, at least. All data requests (e.g. peek, dequeue, etc.) return null. You can also easily transfer some new objects. Purely functional seems to work.
But I really would like to know if I am doing this correctly.
source
share