How does next() method in iterator class differ in output in arraylist collection class and linkedlist collection class????????? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How does next() method in iterator class differ in output in arraylist collection class and linkedlist collection class?????????

Why does the next() method(iterator) in linkedlist collection class bring the very first element and in arraylist collection class the next() method brings(outputs) the second element on the list

23rd Nov 2018, 11:52 AM
hane Smitter
hane Smitter - avatar
1 Answer
+ 3
In both ArrayList and LinkedList next() method[Iterator] class bring first element. https://code.sololearn.com/cYnB0ZE3dqUU/?ref=app https://code.sololearn.com/cYJ8C79jgepi/?ref=app
14th Sep 2020, 6:09 AM
Ketul Patel
Ketul Patel - avatar