JoinData (@NotNull List<PsiExpression> joinParts) { List<PsiExpression> delimiterJoinParts = new ArrayList<>(); int firstNonConstant = -1; StringBuilder sb = new StringBuilder(); for (int i = 0, size = joinParts.size(); i < size; i++) { PsiExpression joinPart = joinParts.get(i); String constantExpression = computeConstant(joinPart); if (constantExpression == null) { firstNonConstant = i; break; } delimiterJoinParts.add(joinPart); sb.append(constantExpression); } String separator = sb.length() == 0 ? null : sb.toString(); if (firstNonConstant != -1) { List<PsiExpression> mainJoinParts = joinParts.subList(firstNonConstant, joinParts.size()); return new JoinData(separator, mainJoinParts, delimiterJoinParts); } return new JoinData(separator, emptyList(), delimiterJoinParts); }