I want to Put two arrays value in LinkedHashMap as key-value. Here is the snippet that I'm using:
String[] s = answer.split("\\,");
String[] ss = aa.split("\\,");
System.out.println(ss.length); -->prints 3
System.out.println(s.length); -->prints 3
What I want is to put s values as Key and ss values as Value in HashMap.
I'm trying to write code.
for(int i=0;i<s.length;i++){
for(int j= 0;j<ss.length;j++){
if(s[i].length()==s[j].length()){
testMap.put(s[i], ss[j]);
}
}
}
But unable to Put into Map. What I've done wrong? And I'm using LinkedHashMap to preserve the order of Insertion.