I am new to Eclipse which I use primarily for Java. I have previously used IntelliJ Idea in which it is possible to select a variable which extends Iteratable (Collection, List etc) and have it produce a correct foreach loop.
I know Eclipse does something similar with the foreach template, where it guesses which variable to iterate over, but I can't get it to the same thing with a selected variable. But what if the variable is not in the current scope and what if Eclipse guesses wrong?
So what I am trying to do is being able to select a variable (or function which returns a variable) which implements Iterator and have it return:
Selection:
functionWhichReturnsList() (which returns List<TypeOfItemsInList>)
Result:
for (TypeOfItemsInList item : functionWhichReturnsList()) {
${cursor}
}
Any ideas?