i using play framework 2.3.8 , need iterate java hashmap in template:
@(city: string, intents: java.util.map[intent, timetable.row], lang: lang) @for((item, index) <- intents.entryset.zipwithindex) { <li>item @index </li> }
the problem got indexes follows:
item 7 item 17 item 22 item 8 item 28 item 23 item 33 item 18 item 5 item 25 item 11 item 16
how possible ordered indices , why list here unordered?
just clarifing carlos's comment
you use implicit scala java convertion:
@import scala.collection.javaconversions._ @(city: string, intents: java.util.map[intent, timetable.row], lang: lang) @for(((intent,row), index) <- intents.tolist.zipwithindex) { <li>item @index : <strong>@intent</strong> <i>row</i></li> }