首页 > 代码库 > Iterator和Enumeration

Iterator和Enumeration

iterator的hasNext()next()方法用于enumeration的hasMoreElements()nextElement()

iterator<FILE> it = a.itreator();

Enumeration<File> en = new  Enumeration<File>(){

@Override

public boolean hasMoreElements(){

return it.hasNext();

}

@Override

public File nextElement(){

return it.next();

}

}