Converting java map into spring map configuration -


i have created map shown below in java program want make through spring way map used in program want keep them configured through spring xml , rite output of program

traderef = aaa tf = aaa traes = aaa deaswe = bbb traref = aaa dealdt = bbb daelet = bbb deadery = bbb 

so can see values hardcoded rite in map below java program trying convert in spring specially way spring xml being configured respect map please advise how can set values in spring map how spring map xml obtain same functionality

as below key value pair want configure

key          value  tf             aaa traes          aaa deaswe         bbb traref         aaa dealdt         bbb daelet         bbb deadery        bbb 

below java class

public class testmap {      public static void main(string[] args)     {           map<string, list<string>> datamap = new hashmap<string, list<string>>();         datamap.put ("aaa", arrays.aslist("traderef", "traref", "tf", "traes"));         datamap.put ("bbb", arrays.aslist("dealdt", "daelet", "deadery", "deaswe"));           map<string, string> itemmap = new hashmap<string, string>(); //new map item->key mapping         for(string key: datamap.keyset()) //get keys , iterate through             for(string item: datamap.get(key)) //for each item in value list                 itemmap.put(item, key); //create new mapping item->key             iterator = itemmap.entryset().iterator();             while (it.hasnext()) {                 map.entry pair = (map.entry)it.next();                 system.out.println(pair.getkey() + " = " + pair.getvalue());                 it.remove(); // avoids concurrentmodificationexception               }     } } 


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -