Boolean (Instruction cur, int destination, LinkedHashSet<Integer> fragmentInsns, boolean wasOutside, HashMap<Instruction, Boolean> visited) { wasOutside = wasOutside || !fragmentInsns.contains(cur.num()); visited.put(cur, null); Iterable<? extends Instruction> instructions = cur.allSuccessors(); boolean pathExists = false; for (Instruction i : instructions) { if (i.num() == destination) return wasOutside; Boolean result; if (visited.containsKey(i)) { result = visited.get(i); } else { result = findPath(i, destination, fragmentInsns, wasOutside, visited); visited.put(i, result); } if (result != null) { if (result.booleanValue()) { visited.put(cur, true); return true; } pathExists = true; } } if (pathExists) { visited.put(cur, false); return false; } else { visited.put(cur, null); return null; } }