Set Iterator toString - JAVA -
Set Iterator toString - JAVA -
i'm doing assignment , within class, have set in order read multiple authors book class. i'm trying figure out how implement tostring. tostring normal , implement iterator such this:
public string tostring(){ iterator itr = set.iterator(); while(itr.hasnext()){ object element = itr.next(); } homecoming "book, isbn:" + isbn +", author:" + element }
does create sense?
first of all, have utilize same method signature of tostring, is:
public string tostring()
second, first line in implementation homecoming statement, renders rest of lines unreachable.
third, putting homecoming statement in loop debatable.
although not quite sure how want implement tostring, need alter these first.
java iterator set tostring
Comments
Post a Comment