You need to sign in to do that
Don't have an account?
Manohar kumar
Problem with reordering
Hi All,
I have a map Map<String, List<QuoteLineItem>>(). In key i am storing product2 name and in value its related lineItem for an quote.Its working fine and i am using this in a page.There is another object name Index_Order__c which has a lookup relationship with product2 and has a number field called Index.I want to rearrange the map based on the index. i did something like this to reslove this..
List<Index_Order__c> dup = [select Products,Index__c from Index_Order__c where Products IN :oldMap.keySet() order by Index__c]; system.debug('###dup '+dup ); Map<String, List<QuoteLineItem>> newMap = new Map<String, List<QuoteLineItem>>(); for(Index_Order__c p1:dup) { newMap.put(p1.Products,oldMap.get(p1.Products)); } system.debug('###newMap'+neMap);
but in debug map order is changged.I assume Map doesnot store order.Pls help me how to get resolve this...
Thanks for your reply pcon.I figured that Map does not store order. i didnot think of making a list. i used a wrapper class instead.Again thanks for your reply.