Replace map for-each by classic for-loop?
Solution 1:
The classic for loop in this case did not iterate "by index" (as there's no index in a Map or Set), but used an iterator:
for (Iterator<Map.Entry<String, String>> iter = seriesMapEntry.getValue().entrySet().iterator(); iter.hasNext();) {
Map.Entry<String,String> column = iter.next();
// some code here
}
Solution 2:
There is no index to iterate over. You can, however, use an explicit Iterator
and a while loop:
String createSelector(Map.Entry<String, Map<String, String>> seriesMapEntry) {
Iterator<Map.Entry<String,String>> iter = seriesMapEntry.getValue().entrySet().iterator();
while (iter.hasNext ()) {
Map.Entry<String,String> column = iter.next ();
String expr = column.getValue();
// some code here
}
}