Does LinkedList expose the head node directly?
mikehaas763 opened this issue · 2 comments
All of the methods I see in the documentation return the element from the underlying array. This makes it impossible to do something like node.next
to walk the linked list. I looked at the source for a minute, am I missing something?
you can't access the list nodes directly, but you can iterate through the list elements using the forEach method.
I see, thanks for the info. If you can't get access to the underlying nodes then quite frankly LinkedList is not a linked list. It's simply a glorified array backed by a linked list implementation. In and of itself though it is not a reusable linked list.
The reason I say this is because one of the main purposes of the linked list data structure is to be able to get to the next node via a direct reference rather than searching for it first.
Thanks for this library though I like several things in it!