java - match the label and get value from Labelvaluebean -


i'm getting list of organization type , code stored labelvaluebean below: [labelvaluebean[org1, xx], [org2, aa]] - in array.

later these values stored in session variable. question is, there way can search thru array match name , code ? (for ex: match org1 , xx). if user enter org1, should send xx back-end.

this sounds want using map instead of array. map store...mappings...between keys , values - think of table 2 columns, first column organization type , second column code. take organization code, in table @ values in first column until find match, on @ second column code, , return it. obviously, handled map implementation used, need declare objects should used keys , values. in case, maybe you'll have map<string, string>.

for example,

map<string, string> map = new hashmap<string, string>(); map.put("org1", "xx"); map.put("org2", "aa"); map.get("org1") // returns "xx" map.get("org2") // returns "aa" 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -