TreeSet goodWords = new TreeSet();
...
Iterator iterGoodWords = goodWords.iterator();
while (iterGoodWords.hasnext()) {
String word = iterGoodWords.next();
System.out.println(word);
}
Tell me, why doesn’t that print anything even if there are some items in the goodWords collection? I know there are items in the set because when I check the size, it’s not zero. It seems that iterGoodWords.hasnext() always evaluates to false.
Javac compiles it. It just doesn’t print.