List<PsiExpression> (@NotNull List<PsiExpression> joinParts, @NotNull PsiLocalVariable localVariable, @NotNull PsiExpression replacement) { List<PsiExpression> copies = ContainerUtil.map(joinParts, expression -> (PsiExpression)expression.copy()); for (PsiElement joinPart : copies) { ReferencesSearch.search(localVariable, new LocalSearchScope(joinPart)).forEach(reference -> { reference.getElement().replace(replacement); }); } return copies; }