Can you please suggest how to iterate a LinkedHashMap using index variable. It important to that I use index variable to iterate the map. I need the index to access the value somewhere else in the same map
Map<String,List<String>> map = new LinkedHashMap<String,List<String>>();
I have written the java code. And trying hard to convert this code in JSTL.
int listcount = 8;
for (Map.Entry<String, List<String>> entry : map.entrySet())
{
List<String> lst = new ArrayList<String>();
lst= entry.getValue();
System.out.println(":::::::"+entry.getKey()+":::::::");
for(int i=0;i<listcount;i++){
System.out.println(lst.get(i));
System.out.println(map.get(entry.getKey()+"New").get(i));
}
}
My JSTL code till now:
<c:forEach items="${theList}" var="entry" varStatus="i">
<tr>
<td>${entry.key}</td>
<c:forEach items="${entry.value}" var="item" varStatus="j">
<td>value: ${entry.value[j.index]}</td>
<td>What to Do here!</td>
</c:forEach>
</tr>
</c:forEach>
sorry, Figured it out. Here's the solution.