From: "Oleg" <[EMAIL PROTECTED]>

I have been hours at this, going crazy. I am setting up Dynamicly sized form.
<form-bean name="dynamicHashmapForm"
type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="fields" type="java.util.HashMap" />
    </form-bean>

http://java.sun.com/j2se/1.4.2/docs/api/java/util/HashMap.html

" This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time. "

Any ideas guys as to how to keep it ordered?

TreeMap will do natural/ascending key order (or you can give it a Comparator):
http://java.sun.com/j2se/1.4.2/docs/api/java/util/TreeMap.html

If you need to retain the order of addition, then LinkedMap (from Commons Collections) looks useful:
http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_1/org/apache/commons/collections/map/LinkedMap.html

--
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to