0 Replies Latest reply on Jul 28, 2009 10:03 AM by jmiguel77

    LinkedHashMap to Object, property order

    jmiguel77

      Hi

       

      I have a List of objects like this

       

      List<Map> dataList = new ArrayList<Map>();

       

      Map<String, String> data1 = new LinkedHashMap<String, String>();

      data1.put("A","1");

      data2.put("B","2");

      data3.put("C","3");

       

      dataList.add(data1);

       

      Map<String, String> data2 = new LinkedHashMap<String, String>();

      data2.put("A", "4");

      data2.put("B","5");

      data2.put("C","6");

       

      dataList.add(data2);

       

      ... and so on, you get the idea;

       

      in flex, the dataList List should be transformed into an ArrayCollection of Objects of this form:

       

      data1.A = "1"

      data1.B = "2"

      data1.C = "3"

       

      data2.A = "4"

      data2.B = "5"

      data2.C = "6"

       

      but the order of the properties is not mantained. I mean, sometimes the objects are created with the properties in the order A,C,B some other times in the order B,A,C and so on

       

      How can i be sure that the objects are created in the order specified inside the LinkedHashMap ??

       

      thanks