String (Set<String> existingNames, boolean end) { String prefix = end ? END_PREFIX : "VAR"; int i = 0; while (myVarNames.contains(prefix + i) || existingNames.contains(prefix + i)) { i++; } return prefix + i; }