I get requestParameters Map from my app and assigning it to a different map with some changed values. Basically output I get is
email=a@a.com login projectname=abc
I want to assign
email=a@a.com request=login projectname=abc
So i did this
tempKey=new String[requestParameters.size()];
tempValue=new String[requestParameters.size()];
requestParams=new HashMap();
while(iterator.hasNext())
{
Map.Entry me=(Map.Entry)iterator.next();
String[] arr=(String[])me.getValue();
if(me.getKey().toString().equalsIgnoreCase("login"))
{
tempKey[i]="request";
tempValue[i]=me.getKey().toString();
}
else
{
tempValue[i]=arr[0];
tempKey[i]=me.getKey().toString();
}
requestParams.put(tempKey[i], tempValue[i]);
log.info(tempKey[i]+"="+tempValue[i]);
i++;
}
I try to print the values from requestParams like this, but i get nothing
iterator=requestParams.entrySet().iterator();
while(iterator.hasNext())
{
Map.Entry me=(Map.Entry)iterator.next();
String[] arr=(String[])me.getValue();
log.info(me.getKey().toString()+"="+arr[0]);
}
It correctly prints the log using tempKey[i]+"="+tempValue[i] but it does not assign values to requestParams (modified map), What is wrong in the above code?
I would copy the existing map and change the different values: