I'm creating a HashMap. While creating it, I can see that keys are assigned proper distinct values, but, after creation, when I iterate it, all the keys are yielding only one value. Below is my code:
public void prepareAccountMap(HashMap<String, Object> masterMap, GAReadConfigType config, Properties prop){
int count=0;
for(Map.Entry<String, Object> entry : masterMap.entrySet()){
String key = entry.getKey();
keyList.add(count, key);
count++;
String childFile = (String)entry.getValue();
System.out.println("First loop, childFile :"+childFile);
if(childFile!=null){
HashMap<String, Object> tempChildMap = config.readConfig(prop.getProperty(GAConstants.GA_XML_CHILD)+ childFile);
accountMap.put(key, tempChildMap.get(GAConstants.GA_DUMMY_KEY));
GAAccountBean beanTest = (GAAccountBean)tempChildMap.get(GAConstants.GA_DUMMY_KEY);
System.out.println("First loop, key :"+key);
System.out.println("First loop, bean dimension :"+beanTest.getDimensionsFromXML().trim());
}
}
System.out.println("");
for(Map.Entry<String, Object> entry : accountMap.entrySet()){
String key = entry.getKey();
GAAccountBean tempBean = (GAAccountBean)accountMap.get(key);
System.out.println("Second Loop, key :"+key);
System.out.println("Second Loop, tempBean dimension :"+tempBean.getDimensionsFromXML().trim());
}
}
Below is the console ouput:
First loop, childFile :\Acct_38058226\Prop_66591454\Prof_68497513\NJTReport2.xml
First loop, key :NJTReport2.xml
First loop, bean dimension :ga:visitorType,ga:date
First loop, childFile :\Acct_38058226\Prop_66591454\Prof_68497513\TestReportNJT1.xml
First loop, key :TestReportNJT1.xml
First loop, bean dimension :ga:browser,ga:date
Second Loop, key :NJTReport2.xml
Second Loop, tempBean dimension :ga:browser,ga:date
Second Loop, key :TestReportNJT1.xml
Second Loop, tempBean dimension :ga:browser,ga:date
Since the value stored in HashMap is a bean, I'm printing one property of the bean. Hope I'm clear with my question. If not, please let me know the caveat and I shall fill it.Thanks in advance!!