hashmap - Java - looping through LinkedhashMap and get the value -


i have following linkedhashmap in put values in following way:

if (preauthorizeannotation != null) {     requestmappingvalues = requestmappingannotation.value(); // url value     requestmethod[] methods = requestmappingannotation.method(); // request method type     system.out.println(+i + ":method  : " + method2.getname() + " secured   ");     //system.out.println("requestion method type : "+methods[0].name());     class[] parametertypes = method2.getparametertypes();     (class class1: parametertypes) {         userdefinedparams = new userdefinedparams();         strclassnametofix = class1.getname();         strclassname = strclassnametofix.replaceall("\\[l", "").replaceall("\\;", "");         if (class1.isarray()) {              //classobj = strclassnames.substring(strclassnames.lastindexof('.')+1, strclassnames.length()-1);             userdefinedparams.setdatatype(strclassname);             userdefinedparams.setisarray("y");             paramslist.add(userdefinedparams);         } else if (class1.isprimitive() && class1.isarray()) {             userdefinedparams.setdatatype(strclassname);             userdefinedparams.setisarray("y");             paramslist.add(userdefinedparams);         } else {             userdefinedparams.setdatatype(strclassname);             userdefinedparams.setisarray("n");             paramslist.add(userdefinedparams);         }         system.out.println("strclassname : " + strclassname);     }     paramsmap.put("url_" + i, requestmappingvalues[0]);     paramsmap.put("params_" + i, paramslist); 

i try loop through map following :

for (object key: paramsmap.keyset()) {     uri = "http://localhost:8080/api" + paramsmap.get(key);     statuscode = httprequest.handlehttprequest(client, uri);     system.out.println("statuscode : " + statuscode); } 

i following exception :

java.lang.illegalargumentexception 

because first time gets url correctly misses params .

i want url , paramlist separately can process it.

i trying url , corrresponding paramlist url , convert paramlist userdefined , value further process.

the best solution have 2 separate maps: 1 urls , other 1 params.


however, seems not need maps since use them lists storing urls , params. should therefore consider using 1 list urls , 1 list params, i append string being key in maps index in lists:

 urls.add(requestmappingvalues[0]);  params.add(paramslist); 

and later iterate on lists retrieve values inserted.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -