Hi I have a list of objects allCrecords which I want to loop through using an iterator In the method printcoauthors I have to create another instance of class Extractdata because that's where the objects are added to the list allCrecords. The getauthor, getcoauthor and gettitle are methods in the Coauthorship class where this method printcoauthors is also
public void printcoauthors(String currentauthor){
Extractdata ed = new Extractdata();
for(Iterator it = ed.allCrecords.iterator();it.hasNext();){
if(currentauthor.equals(getauthor()))
System.out.println(getcoauthor());
else if (currentauthor.equals(getcoauthor()))
System.out.println(getauthor());
System.out.println(gettitle());
Object element = (Object)it.next();
}
}
thanks in advance