// Iterate through the list, printing each in turn.
Iterator it = aLinkedList.iterator();
while (it.hasNext()) {
MyDataStructure aDataStructure = (MyDataStructure)it.next();
System.out.println(aDataStructure);
}
}
public static void main(String[] args) {
LinkedListDemo linkedListDemo1 = new LinkedListDemo();
}
}
class MyDataStructure {
int number;
String msg;
double value;
public MyDataStructure(int theNumber, String theMsg, double theValue) {
number = theNumber;
msg = new String(theMsg);
value = theValue;
}
public String toString() {
return "number = "+number+" || msg = "+msg+" || value = "+value;
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.