FYI, as of JDK 1.4.2 (maybe before, but at least that version at the latest) you have LinkedHashMap and LinkedHashSet as well. LinkedHashMap would fit the bill as well I think, without having to create a dependency on Commons Collections.

Frank

Wendy Smoak wrote:
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


--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [EMAIL PROTECTED]

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

Reply via email to