This should be "while (it.hasNext()) {" not "while(it.hasNext()) {"