+ 3
How to initialize a LinkedList object with elements when creating it.
There is some way to initialize a LinkedList object at the time of creating it other than this one.. LinkedList lst; List l = Arrays.asList(1,5,2,3,9); lst = new LinkedList(l); https://code.sololearn.com/cr799j68SGQ3/?ref=app
1 Answer
0
Dang I did not know this was a thing. I had to learn them using head and tail technique.
head is the first node with n elements until the tail and the tail points to null.
In java, you set the next node as a new object of itself and link the new node to null