Assuming all cases of iterative code are similar to your example, try using a search and replace with the following regular expression.
Search:
Iterator<([a-zA-Z0-9_]{1,})> [a-zA-Z0-9_]{1,} = ([a-zA-Z0-9_]{1,})\.iterator\(\);\R[\t]{1,}while \(iterator\.hasNext\(\)\) \{\R[\t]{1,}[a-zA-Z0-9_]{1,} ([a-zA-Z0-9_]{1,}) = iterator\.next\(\);
Replace:
for($1 $3 : $2) {
source share