The previous code only handled the case where the variable being looped over is used exactly once in a condition (converted to find) or an early return (converted to map). This handles all cases.
It's not the greatest since I'm creating a new class that extends NameExpr and has to be dealt with as a special case in ModifierVisitor, but there's no way to add new expressions without changing javaparser (and scala expressions/nodes shouldn't be in there).
The previous code only handled the case where the variable being looped over is used exactly once in a condition (converted to find) or an early return (converted to map). This handles all cases. It's not the greatest since I'm creating a new class that extends NameExpr and has to be dealt with as a special case in ModifierVisitor, but there's no way to add new expressions without changing javaparser (and scala expressions/nodes shouldn't be in there).