SettingsGroup (String fieldName) { if (myFieldNameToGroup == null) { myFieldNameToGroup = new HashMap<>(); Set<String> groups = myGroupToFields.keySet(); for (String group : groups) { Collection<String> fields = myGroupToFields.get(group); SettingsGroup settingsGroup = new SettingsGroup(group, fields); for (String field : fields) { myFieldNameToGroup.put(field, settingsGroup); } } } return myFieldNameToGroup.get(fieldName); }