public static void printFib(List<Integer> fib){
JTextArea text = new JTextArea();
for(Iterator<Integer> it = fib.iterator(); it.hasNext(); it.next() ){
text.append(it.toString());
text.append("\n");
}
JOptionPane.showMessageDialog(null,text);
}
How can I modify this to have it actually print the data contents and not the pointer address?
Do you really need an interator?
If for some reason you need an iterator for something else, then you use it as:
Edit: To summarize comments below; Rather than getting the
Integerthe iterator contained viait.next(), The OP was calling the iterator’stoString()method and receiving aStringcontaining the hex representation of the iterator’s hash code.