+ 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

10th Mar 2018, 2:03 AM
Javier I. Rivera R.
Javier I. Rivera R. - avatar
1 Answer
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
10th Mar 2018, 2:19 AM
「HAPPY TO HELP」 - avatar