+ Start a Discussion
JitheshJithesh 

Map must have exactly 2 type arguments - Error

Here is my code,

 

I am getting an error at highlited red linke" Map must have exactly 2 type arguments"..any idea whats going on

map<String, list<map<string,list<map<String,double>>>>> fiscactual = new map<String, list<map<string,list<map<String,double>>>>>();
map<string,list<map<String,double>>> fisc = new map<string,list<map<String,double>>>();
map<String,double> cust = new map<String,double> ();

list<AggregateResult> aggr = [select Named_Account__c,Fiscal_Periods__c,Customer_Segment__c,SUM(Total_Revenue__c) from Opportunity 
									  where StageName ='Booked' and Named_Account__c IN : namedaccIds group by Named_Account__c,Fiscal_Periods__c,Customer_Segment__c];
			for(AggregateResult agg: aggr){
				String s = String.valueof(agg.get('Named_Account__c'));
				if(fiscactual.containsKey(s) && fiscactual.get(s)!= null && fiscactual.get(s).size() > 0){
					for(map<string,list<map<String,double>>> fiscal : fiscactual.get(s)){
						String r = String.valueof(agg.get('Fiscal_Periods__c'));
						fisc = fiscal;
						if(fisc.containsKey(r)&& fisc.get(r)!= null && fisc.get(r).size() > 0)	{
							for(map<String,double> customer :fiscal.get(r) ){
								String c = String.valueof(agg.get('Customer_Segment__c'));
								cust = customer;
								if(!(cust.containsKey(c))){
									map<list<map<String,double>>> custFiscMap = new map<list<map<String,double>>> ();
		 							list<map<String,double>> custlist = new list<map<String,double>>();
									map<String,double> custMap = new map<String,double> ();							
									custMap.put(String.valueof(agg.get('Customer_Segment__c')),double.valueof(agg.get('expr0')));
									custlist.add(custMap);
									custFiscMap.put(String.valueof(agg.get('Fiscal_Periods__c')),custlist);	
									fiscactual.get(s).add(custFiscMap);	
								}
							}
						}		
					}
				}
			}	

 

sfdcfoxsfdcfox

The error is actually on the line below it:

 

map<list<map<String,double>>> custFiscMap = new map<list<map<String,double>>> ();

 Here, you specified a key or value of type "list<map<string,double>>" without a second value to the pair.