List<PsiExpression> (@NotNull List<? extends PsiStatement> statements) { List<PsiExpression> joinParts = new ArrayList<>(); for (PsiStatement statement : statements) { PsiExpressionStatement expressionStatement = tryCast(statement, PsiExpressionStatement.class); if (expressionStatement == null) return null; PsiExpression expression = expressionStatement.getExpression(); if (!tryExtractJoinPart(expression, joinParts)) { return null; } } return joinParts; }