I am trying to insert list of wrapper class records in a MAP taking group name as KEY and related Wrapper class records as value pair .
the wrapper classes were
public class SCQLWrapperClass
{
public date stDate{get;set;}
public date endDate{get;set;}
public String stDate1{get;set;}
public String endDate1{get;set;}
public double months{get;set;}
public double quantty{get;set;}
public double ppMonth{get;set;}
public double discount{get;set;}
public double netPrice{get;set;}
public double billTotal{get;set;}
public String itmDesc{get;set;}
}
public class groupingWrapClass
{
public String yearname{get;set;}
public Double billingtotal{get;set;}
public Double pricepermonth{get;set;}
public Double netpricepermonth{get;set;}
public List<SCQLWrapperClass> grpClsLst{get;set;}
public groupingWrapClass(String yearname,Double pricepermonth,Double netpricepermonth,List<SCQLWrapperClass> grpClsLst)
{
this.yearname = yearname;
this.pricepermonth = pricepermonth;
this.netpricepermonth = netpricepermonth;
this.grpClsLst = grpClsLst;
}
}
The Map was
Map map_lineitems_Group=new Map();
i was inserting values into the map taking keys from a sorted list as per user case.
the list contains group names { XYZ, ABC}
What ever the way i insert
map_lineitems_Group.put('XYZ', keyvalues);
map_lineitems_Group.put('ABC', keyvalues);
or in reverse way
map_lineitems_Group.put('ABC', keyvalues);
map_lineitems_Group.put('XYZ', keyvalues);
while iterating in VF page and debug logs too it is giving ABC as 1st group and XYZ as 2nd group. But i want it to be same order as in list. This list is a dynamic list, so i cannot predict the order too..
I have tried to loop over the map with a duplicate map , but results the same ...
Is there any way to get the resulting map as desired...