Thank you for your reply. So we need to create a reference to the iterator that is returned by
al.iterator()
, hmmm, interesting. I think now I understand why my code was not working. It was using a new iterator object that is returned by al.iterator each time the code ran. That was the reason it never get beyond the first element in the list. Thanks again. :-) :-)