boolean (List<Exprent> lst) { boolean result = false; for (int i = 0; i < lst.size(); i++) { Exprent exprent = lst.get(i); exprentReplaced = false; Exprent retexpr = processExprentRecursive(exprent); if (retexpr != null) { lst.set(i, retexpr); result = true; i--; // process the same exprent again } result |= exprentReplaced; } return result; }