Lecture 15
16
toString for collections
•
TreeMapDemo.java
–
108 terminal.println(map.toString());
–
produces output
–
{one=1, three=3, two=1}
–
“{ (key.toString()=value.toString(),
… }”
•
ArrayList toString produces
–
“[ 0
th
item toString, 1
st
item toString … ]”
•
Very useful for debugging