PrepopulatedCollectionModel (PsiNewExpression newExpression, String type, String className) { PsiExpressionList argumentList = newExpression.getArgumentList(); if (argumentList != null) { PsiExpression[] args = argumentList.getExpressions(); PsiJavaCodeReferenceElement classReference = newExpression.getClassReference(); if (classReference != null && className.equals(classReference.getQualifiedName())) { return fromCopyConstructor(args, type); } PsiAnonymousClass anonymousClass = newExpression.getAnonymousClass(); if (anonymousClass != null && args.length == 0) { PsiJavaCodeReferenceElement baseClassReference = anonymousClass.getBaseClassReference(); if (className.equals(baseClassReference.getQualifiedName())) { return fromInitializer(anonymousClass, type, COLLECTION_ADD); } } } return null; }