List<TargetTypeBuildScope> (@NotNull List<TargetTypeBuildScope> scopes1, @NotNull List<TargetTypeBuildScope> scopes2) { if (scopes2.isEmpty()) { return scopes1; } if (scopes1.isEmpty()) { return scopes2; } Map<String, TargetTypeBuildScope> scopeById = new HashMap<>(); mergeScopes(scopeById, scopes1); mergeScopes(scopeById, scopes2); return new ArrayList<>(scopeById.values()); }