boolean (@NotNull List<? extends PsiElement> elements) { PsiElement first = elements.get(0); PsiType firstType = extractType(first); if (firstType == null) return false; return elements.stream() .map(element -> (PsiExpression)element) .allMatch(expr -> firstType.equals(expr.getType())); }