PsiElement (PsiMethodCallExpression toArrayCall) { if (!TO_ARRAY.test(toArrayCall)) return null; CommentTracker ct = new CommentTracker(); String replacement = getReplacement(toArrayCall, ct); if (replacement == null) return null; PsiMethodCallExpression streamCall = getQualifierMethodCall(toArrayCall); if(streamCall == null) return null; PsiExpression collectionExpression = streamCall.getMethodExpression().getQualifierExpression(); if(collectionExpression == null) return null; return ct.replaceAndRestoreComments(toArrayCall, ct.text(collectionExpression) + ".toArray(" + replacement + ")"); }