String (@NotNull Collection<String> variants) { if (variants.isEmpty()) { return registerVarName(Collections.singleton("val")); } for (int idx = 0; ; idx++) { for (String variant : variants) { String name = idx == 0 ? variant : variant + idx; if (!isUsed(name)) { myUsedNames.add(name); return name; } } } }