Map<Integer, Map<String, String>> movie = new HashMap<Integer,Map<String, String>>();
Map<String,String> sub = new HashMap<String,String>();
I'm doing this to populate and trying to iterate it:
Iterator<Element> releases = doc.select(
"div.pmovie > div.releases > div.release").iterator();
Iterator<Element> subt = doc.select(
"div.release-info > div.section > div.links > div > a")
.iterator();
int movindex = 1;
while (subt.hasNext()) {
Element rel = releases.next();
Element subti = subt.next();
release = rel.text();
Log.v("RELEASES", release);
subtitulo = subti.attr("href");
Log.v("SUBTITULO", subtitulo);
sub.put(release,subtitulo);
movie.put(movindex, sub);
movindex++;
}
for (Entry<Integer, Map<String,String>> entry : movie.entrySet()) {
key = entry.getKey();
sub = entry.getValue();
for (Entry<String,String> entrada : sub.entrySet()) {
subtitle = entrada.getKey();
ruta = entrada.getValue();
Log.v("SUB ITERATOR", key+" "+subtitle);
}
The problem I'm reaching is with the inner "for". It is getting all the "sub" Map values when I'm only need the pair (K,V) referenced by the outer Map key values. What is the correct way to iterate this Map inside a Map? How can I a reach an specific (K,V) from the inner Map using the key of the outer Map?
Thanks!