如果我有一个迭代器,我想检查最后一个值,我该怎么检查?喜欢
private Set saarcCountries = new TreeSet();
Iterator iter = saarcCountries.iterator();
while(iter.hasNext()) {
String name = (String)iter.next();
int countryId = Integer.parseInt(name);
newsOrAnnouncementInsert.add(newsId);
newsOrAnnouncementInsert.add(countryId);
newsOrAnnouncementInsert.add(1); //addby
if (!(last value in iterator))) {
newsOrAnnouncementInsert.add("~!~");//Delimiter for Multiple Detail Records
}//end if
} //end of while
如何检查最后一个值。什么应该替代迭代器中的最后一个值?