I\'m so very new to Arraylists & iterators & this is the first time I got this exception. I have an ArrayList u & I\'d like to do the following algorithm:
how exactly i must put the while(iter.hasNext())
You can use iterator
as below:
Iterator iter = u.iterator();
while(iter.hasNext())
{
Character c = iter.next();
.....
}
Initialize your list with generics: List
Hint: use iter.remove()
, iter.add()
wherever applicable instead of u.remove()
and u.add()
.
You need to start here: http://www.tutorialspoint.com/java/java_using_iterator.htm