Java LinkedList iterator being exhausted prematurely
- by Sujeet
I am using LinkedList and retrieving an Iterator object by using list.iterator(). After that, I am checking it.hasNext(), real issue is while checking it.hasNext(), sometimes it returns false. I need help why this is happening, though I have elements in the list.
Some code:
public synchronized void check(Object obj) throws Exception {
…