void (@NotNull MavenArchetype archetype, @NotNull Path userArchetypesPath) { List<MavenArchetype> archetypes = new ArrayList<>(loadUserArchetypes(userArchetypesPath)); int idx = archetypes.indexOf(archetype); if (idx >= 0) { archetypes.set(idx, archetype); } else { archetypes.add(archetype); } saveUserArchetypes(archetypes, userArchetypesPath); }