I created a class MyList that has a field
private LinkedList<User> list;
I would like to be able to iterate over the list as follows:
for(User user : myList) { //do something with user }
(when my list is an instance of MyList). How? What should I add to my class?
java iterator linked-list
snakile
source share