0

I am using jsf2.0 with icefaces3. I have a selectonemenu populated with a map object and my map has a list of currencies. When i run my jsp i see that my dropdown is populated, but the list of currencies are not ordered in the manner in which i orignially loaded my map. Below is my code snippet.

-------XHTML-------
<ice:selectOneMenu  id="curr"  label="Currency"  value="#{strformbean.valueOfTranCurr}"
    styleClass="formDrpDown"   >
<f:selectItems value="#{strformbean.currencyMap}"  /> 
</ice:selectOneMenu>
-------BEAN--------
    public static Map getCurrency() {
        Currency [] currencies = new Currency[]{};
        Map currency = new HashMap();        
        currency.put("Algerian Dinar","DZD");
        currency.put("Argentine Peso","ARS");
        currency.put("Australian Dollar","AUD");
        currency.put("Bahraini Dinar","BHD");
        currency.put("Belgian Franc","BEF");
....
}
A_nto2
  • 1,106
  • 7
  • 16
ZEE
  • 381
  • 1
  • 6
  • 20

1 Answers1

0

try replacing HashMap with LinkedHashMap it should remember the insertion order...

Daniel
  • 36,833
  • 10
  • 119
  • 200
  • THANKS Daniel, This has helped, i also came to know that TreeMap is specially for ordered collection – ZEE Aug 06 '12 at 03:46