while(element != null)
{
//temp = element (useless)
element = element.node;
//can't do (element.node).method();
//neither temp.method();
}
To traverse a LinkedList we do the above. However, what if I want to go back to an earlier node? Is that even possible? I thought about storing the node in a temp variable, but I wouldn't be able to changes the nodes in the LinkedList since the temporary variable would only store the value of the node and not the object.
I didn't expect LinkedList to be so difficult to work with, because I was used to working with non-dynamic data structures (array).