Hi,
It is safe for some collections, but not necessarily all. TreeMap
elements are sorted (when iterating over them). Sometimes, this order
matters. It's also inefficient to iterate over the elements of a
HashMap. There are LinkedHashMaps for efficient iteration, but element
ordering is then determined by insertion order instead of sort order.
One reason I've used TreeMaps (before LinkedHashMap was added to the
standard library) is so that problems could be reproduced, because
ordering is preserved from one execution to the next. But, you can
always try replacing them with LinkedHashMaps which also preserve
ordering from one execution to the next.
Have fun!
Etienne
Etienne Gagnon, Ph.D.
http://sablecc.org