Holder (PsiExpression condition, PsiVariable variable, PsiElement secondDeclaredElement) { condition = PsiUtil.skipParenthesizedExprDown(condition); if (!(condition instanceof PsiBinaryExpression binaryExpression)) { return null; } final IElementType tokenType = binaryExpression.getOperationTokenType(); final PsiExpression rhs = binaryExpression.getROperand(); final PsiExpression lhs = binaryExpression.getLOperand(); if (tokenType.equals(JavaTokenType.LT)) { if (!ExpressionUtils.isReferenceTo(lhs, variable)) { return null; } return getCollectionFromListMethodCall(rhs, HardcodedMethodConstants.SIZE, secondDeclaredElement); } if (tokenType.equals(JavaTokenType.GT)) { if (!ExpressionUtils.isReferenceTo(rhs, variable)) { return null; } return getCollectionFromListMethodCall(lhs, HardcodedMethodConstants.SIZE, secondDeclaredElement); } return null; }