String (PsiClass psiClass, PsiRecordComponent @NotNull [] components) { String equalsExpression = StreamEx.of(components).map(c -> generateEqualsExpression(c)).joining(" &&\n"); String body = components.length == 0 ? "return obj == this || obj != null && obj.getClass() == this.getClass();" : "if(obj == this) return true;\n" + "if(obj == null || obj.getClass() != this.getClass()) return false;\n" + (myLanguageLevel.isAtLeast(HighlightingFeature.LVTI.getLevel()) ? PsiKeyword.VAR : psiClass.getName()) + " that = (" + psiClass.getName() + ")obj;\n" + "return " + equalsExpression + ";\n"; return "@" + CommonClassNames.JAVA_LANG_OVERRIDE + "\n" + "public boolean equals(" + CommonClassNames.JAVA_LANG_OBJECT + " obj) {\n" + body + "}\n"; }