this is a sample code from delete function in my LinkedList class which deletes a node from middle.
temp.getPrev().setNext(temp.getNext());
temp.getNext().setPrev(temp.getPrev());
temp.setNext(null);
temp.setPrev(null);
my question is do i have to set temps next and prev references to null or does garbage collector handle with this automatically_?. i will appreciated very much if you can help me. and thanks anyway.
Garbage Collector analyze if there is any reference to an object. Since there is no reference to temp
after your method is finished, GC should remove this object.