Looping through a List<Map<Integer, Map<Long, Integer>>> in Java -
as title suggests, i'm struggling looping through data structure given.
i have list of maps contain integer key , map value contains long , integer.
how can loop through list, map, map able access of required fields?
thanks.
edit: in response comments, looping through list i'm fine with. step 1 loop through list, i'm left with:
for (map<integer, map<long, integer>> periodscores : request.getperiodscoremap()) { ... }
it's goes in there confuses me.
currently have:
for (map<integer, map<long, integer>> periodscores : request.getperiodscoremap()) { while (periodscores.entryset().iterator().hasnext()) { map<integer, map<long, integer>> opponentscores = (map<integer, map<long, integer>>) periodscores.entryset().iterator().next(); } }
and i'm struggling final map of
its matter of being careful , being able differentiate between map
, list
iterations
here example:
for ( map<integer, map<long, integer>> level1 : list){ for(map.entry<integer,map<long, integer>> level2 : level1.entryset() ){ for(map.entry<long,integer> level3 : level2.getvalue().entrylist(){ } } }
Comments
Post a Comment